node.js - Gulp task for multiple files -
i'm trying create gulp task creates (in case minifies) css file every project css there is. project should combine , minify following files:
global.projecta.css tool1.projecta.css tool2.projecta.css
it needs kind of loop or something...? if there new project d, should build too. if need add "projectd" array, ok too.
this directory structure css
./global.projecta.css ./global.projectb.css ./global.projectc.css ./addons/tool1.projecta.css ./addons/tool2.projecta.css ./addons/tool1.projectb.css ./addons/tool2.projectb.css ./addons/tool1.projectc.css ./addons/tool2.projectc.css
this not working task
// not working.... gulp.task('css', function() { return gulp.src(['global.*.css', 'addons/tool*.css', '!*.min.css']) .pipe(concat('build.css')) .pipe(rename({suffix: '.min'})) .pipe(minifycss()) .pipe(gulp.dest('build/css')); });
you try this, although requires manually entering array of projects.
gulp.task('css', function() { var projects = ['a','b','c']; projects.foreach( function(proj) { gulp.src(['global.' + proj + '.css', 'addons/tool*.' + proj + '.css', '!*.min.css']) ... }); });
Comments
Post a Comment