Answer the question
In order to leave comments, you need to log in
How to attach other files to a stream in gulp?
I want to combine all javascript and coffee files into 1 file, the problem is that if you process everything together, then the coffeesrctip compiler swears.
there is no problem with css and less because less is backwards compatible
gulp.task('src/js/main.coffee', function () {
gulp.src(path.src.js) //Найдем наш main файл
.pipe(plumber())
.pipe(rigger())
.pipe(coffee({bare: false}))
.pipe(uglify())
.pipe(gulp.dest('build/js/')) //Выплюнем готовый файл в build
.pipe(reload({stream: true})); //И перезагрузим сервер
});
Answer the question
In order to leave comments, you need to log in
See solutions here: stackoverflow.com/questions/21719833/how-to-add-sr...
And I recommend breaking everything down into separate tasks:
- compiling coffee
- combining js
(I would also take out minification as a separate task)
And make the third a task that runs them one by one.
This will turn out to be more flexible and modular, you can make various build options.
es = require("event-stream");
es = require("event-stream");
gulp.task('js:build', function () {
es.concat(
gulp.src(path.src.js)
,gulp.src(path.src.coffee).pipe(rigger()).pipe(coffee())
).pipe(gulpConcat('main.js'))
.pipe(rigger())
.pipe(uglify()) //Сожмем наш js
.pipe(gulp.dest(path.build.js)) //Выплюнем готовый файл в build
.pipe(reload({stream: true})); //И перезагрузим сервер
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question