javascriptgulpbowergulp-pluginmain-bower-files

Is it possible to put bower `main` files to specific folder with gulp plugin?


Is it possible to copy .js files to one specific javascript folder with gulp plugin main-bower-files ?

var gulp = require('gulp'),
    bower = require('gulp-bower'),
    mainBowerFiles = require('gulp-main-bower-files'),
gulp.task('mainbower', function() {
    return gulp.src('./bower.json')
        // .pipe(mainBowerFiles([[filter, ]options][, callback]))
        .pipe(mainBowerFiles())
        .pipe(gulp.dest('./wwwroot/libs'));
});

Here is the current folder copying result as separate folder with the plugin 👇

enter image description here


Solution

  • gulp-main-bower-files returns only list of files which can be passed to gulp.src().

    To squash directories tree b https:/st plugin is https://github.com/armed/gulp-flatten