S
S
Sergey Vershinin2016-11-24 23:01:35
gulp.js
Sergey Vershinin, 2016-11-24 23:01:35

How to compile project gulp + vue files into one js and css?

Hello. recently started to deal with building a project written in vuejs. For simple things, I used gulp, so I started with it.
In Gulp, I created a task that collects js and scss into one file. there are no problems here. But what about when vuejs comes along? I have so far managed to assemble vue components into 1 js and 1 css file.
I would like to know if it is possible to combine all this? here is an example gulpfile.js .
The first thing that came to mind was that you need to run everything in turn, i.e. first I will build a vuejs application, and then I will collect the results in general tasks with styles and JS scripts.
but

gulp.task('build', ['clean', 'vue', 'styles', 'scripts', 'fonts']);

sequentially dependent tasks are not launched. Yes, I know that they (tasks) are launched simultaneously, but I also read that if streams are returned in each task, then the order must be observed.
Maybe gulp is not suitable for such a task at all?
Help with direction to solve the problem

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2016-11-25
@versh23

для строго очередного запуска попробуйте gulp-sequence

var gulpSequence = require('gulp-sequence');
var defaultTask = function (cb) {
    gulpSequence(['task1', 'task2'], ['task3', 'task4'], 'watch', cb);
};

task1 и task2 запустятся параллельно
task3 и task4 тоже
но сначала выполнится 1 и 2, потом 3 и 4, потом watch

K
kalapanga, 2017-03-11
@logpol32

You would better bring all the real code that does not work, you can only guess from these pieces, like on coffee grounds. And it turns out to be more than strange, to talk about an error when working with an array and not to declare an array. Especially since you yourself write that the error is there. Select such a minimal piece of code, the operation of which leads to an error, but which you can copy for yourself, compile, run and look at the errors. And maybe without it everything will be clear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question