1 gulp file build multiple projects

I am building a series of plugins for WP, and want to use gulp to manage the assets.

I have created a strict naming/directory pattern in each of the plugins, in order to make using the task management easier. Currently all the plugins sit in the basic WP structure, and my gulp file sits below root and runs fine.

Read More

I am now extracting all the plugins into composer packages. I now want to build the plugins, and leave all the assets in the plugin directories rather than dumping them to the theme. I have now put the “builder” into its own package, which I can run from my IDE.

e.g.
pluginOne
pluginTwo
pluginBuilder

I have so far created this to find the scss files build the style:
How can I tell gulp to pipe back to the directory it found? I’ve only managed to get it to pipe to specific dir

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

    glob('../plugins/pluginprefix-*/assets/build/scss/pluginprefix.*.scss', {}, function (er, files) {
        gulp.src(files)
          .pipe(plugins.plumber())
          .pipe(plugins.sass())
          .pipe(plugins.autoprefixer('last 10 version'))
          .pipe(plugins.minifyCss())
          .pipe(gulp.dest(''));
       })
});

Thanks for any help or advice =)

Related posts

1 comment

  1. This should work:

    var rename = require('gulp-rename');
    
        ...
    
              .pipe(rename(function(path){
                 path.dirname = path.dirname;
                 path.basename = path.basename;
               });         
              .pipe(gulp.dest(''));
    

Comments are closed.