javascript - Pipe vendor js files from Bower and own js files into unique stream in Gulp -


i'd grab vendor js files bower dependencies, and, along own js files, pipe through other tasks , concat them 1 .js file. , same sass files.

how achieve that? tried this, doesn't work:

gulp.task('scripts', function () {    return gulp.src([         mainbowerfiles(gulpfilter('*.js')),         'app/js/*.js'         ])       .pipe(uglify())       .pipe(concat('app.js'))       .pipe(gulp.dest('./dist/js')); }); 

it throws error:

typeerror: arguments path.resolve must strings 

but works if have this, example:

gulp.src([     'app/js/etc.js',     'app/js/main.js' ]) 

..and in following case, throws different error (but no error without uglify()):

gulp.src(mainbowerfiles(gulpfilter('*.js'))) 

error:

events.js:72         throw er; // unhandled 'error' event 

how better debug this? should separate vendor / own js files in different streams?

update

i'm working 2 streams, , merging them later on event-stream, this:

gulp.task('scripts', function () {      var jsfilter = gulpfilter('*.js');     var vendorfiles = gulp.src(mainbowerfiles()) // don't read         .pipe(jsfilter)         .pipe(concat('vendor.js'));      var appfiles = gulp.src('app/js/*.js')         .pipe(jshint())         .pipe(jshint.reporter('default'))         .pipe(concat('app.js'));      return es.concat(vendorfiles, appfiles)         .pipe(uglify())         .pipe(concat('app.js'))         .pipe(gulp.dest('./dist/js')); }); 

it works great, i'm not able handle order of files. i'd vendor code come before code @ destination's app.js, that's doesn't happen. created thread here.

solved gulp-event-stream , gulp-order. intrigues me little gulp-order trending downward @ https://www.npmjs.org, though.

gulp.task('scripts', function () {      var jsfilter = gulpfilter('*.js');     var vendorfiles = gulp.src(mainbowerfiles())         .pipe(jsfilter)         .pipe(concat('vendor.js'));      var appfiles = gulp.src('app/js/*.js')         .pipe(jshint())         .pipe(jshint.reporter('default'))         .pipe(concat('app.js'));      return eventstream.concat(vendorfiles, appfiles)         .pipe(order([             "vendor.js",             "app.js"         ]))         .pipe(concat('app.js'))         .pipe(uglify())         .pipe(gulp.dest('./dist/js')); }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -