Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add src files in the middle of a pipe

I want to process some files with 'coffee', add some js files, concat and minify.

This does not work, coffee fails on the regular js files:

gulp.task 'build-js', ->   gulp.src([       "bower_components/mbdev-core/dist/js/db.js"       "bower_components/mbdev-core/dist/js/utils.js"       "src/js/config/app.coffee"       "src/js/config/app-db.coffee"                     "src/js/accounts/accounts.coffee"       "src/js/budget_items/budget_items.coffee"       "src/js/line_items/line_items.coffee"       "src/js/misc/misc.coffee"       "src/js/reports/report_generators.coffee"       "src/js/reports/reports.coffee"    ])   .pipe(coffee()).on('error', gutil.log)   .pipe(concat('app.js'))   .pipe(gulp.dest('public/js')) 

Is there a way to add files after the coffee part?

like image 500
mbdev Avatar asked Feb 12 '14 05:02

mbdev


People also ask

How to open SRC files in Windows?

The first and the easiest one is to right-click on the selected SRC file. From the drop-down menu select "Choose default program", then click "Browse" and find the desired program. The whole operation must be confirmed by clicking OK.

What does the src attribute do in HTML?

The src attribute specifies the location (URL) of the external resource. Your browser does not support the audio element. An audio player with two source files. The browser should choose which file (if any) it has support for: Your browser does not support the audio element.

Why is my src file not working with my programs?

If you are sure that all of these reasons do not exist in your case (or have already been eliminated), the SRC file should operate with your programs without any problem. If the problem with the SRC file has not been solved, it may be due to the fact that in this case there is also another rare problem with the SRC file.


1 Answers

You don't need to add files to the original src, but rather to use coffee only "if"...

So, use gulp-if

gulp.task('task', function() {   gulp.src('./stuff/*')     .pipe(gulpif(/[.]coffee$/, coffee()))     .pipe(gulp.dest('./dist/')); }); 

See here more about gulp-if.

like image 112
Mangled Deutz Avatar answered Oct 14 '22 11:10

Mangled Deutz