ck86 / main-bower-files

Getting all main bower files
583 stars 56 forks source link

Can this be used with gulp-add-src? #156

Open mcblum opened 8 years ago

mcblum commented 8 years ago

We have some dependencies in Bower, some in NPM. For some reason the following isn't working:

gulp.task('vendor', function () {

    // define our filters
    var jsFilter = gulpFilter(['**/*.js'], {
        restore: true
    });
    var cssFilter = gulpFilter(['**/*.css'], {
        restore: true
    });

    return gulp.src(mainBowerFiles({
        paths: {
            bowerDirectory: src.bower + 'bower_components',
            bowerJson: src.bower + 'bower.json'
        }
    }))
        .pipe(jsFilter)
        .pipe(addsrc([
            './node_modules/hoshi/dist/hoshi.js',
            './node_modules/angular-gsapify-router/angular-gsapify-router.js',
            './node_modules/hoshiImageLoader/dist/main.min.js',
            './node_modules/hoshiCustomContent/dist/main.min.js',
            './node_modules/headroom.js/dist/headroom.min.js',
            './node_modules/headroom.js/dist/angular.headroom.min.js'
        ]))
        .pipe(concat('vendor.js'))
        .pipe(gulpif(util.env.production, uglify()))
        .pipe(gulp.dest(dist.js))
        .pipe(jsFilter.restore)
        .pipe(cssFilter)
        .pipe(concat('vendor.css'))
        .pipe(gulpif(util.env.production, cssnano()))
        .pipe(gulp.dest(dist.css))
});

It's finding all of the main Bower files but none of my manual includes. Any idea why that would be?

Thanks for your hard work on this library!

TrySound commented 8 years ago

All this plugin do is looking for files. This function works well as you said. Your issue relates to gulp-add-src or gulp itself, not this module.

Are you sure your gulpfile.js and node_modules are placed in the same directory? Also you better split js and css task, caz they have nothing common except main-bower-files, but you may call it twice and use css and js filter option in it.