Saturday, 15 June 2013

javascript - Can I use a Gulp task with multiple sources and multiple destinations? -



javascript - Can I use a Gulp task with multiple sources and multiple destinations? -

i have next in gulpfile.js:

var sass_paths = [ './httpdocs-site1/media/sass/**/*.scss', './httpdocs-site2/media/sass/**/*.scss', './httpdocs-site3/media/sass/**/*.scss' ]; gulp.task('sass', function() { homecoming gulp.src(sass_paths) .pipe(sass({errlogtoconsole: true})) .pipe(autoprefixer('last 4 version')) .pipe(minifycss({keepbreaks:true})) .pipe(rename({ suffix: '.min'})) .pipe(gulp.dest(???)); });

i'm wanting output minified css files next paths:

./httpdocs-site1/media/css ./httpdocs-site2/media/css ./httpdocs-site3/media/css

am misunderstanding how utilize sources/destinations? or trying accomplish much in single task?

edit: updated output paths corresponding site directories.

i guess running tasks per folder recipe may help.

update

following ideas in recipe, , oversimplifying sample give idea, can solution:

class="lang-js prettyprint-override">var gulp = require('gulp'), path = require('path'), merge = require('merge-stream'); var folders = ['httpdocs-site1', 'httpdocs-site2', 'httpdocs-site3']; gulp.task('default', function(){ var tasks = folders.map(function(element){ homecoming gulp.src(element + '/media/sass/**/*.scss', {base: element + '/media/sass'}) // ... other steps ... .pipe(gulp.dest(element + '/media/css')); }); homecoming merge(tasks); });

javascript node.js gulp

No comments:

Post a Comment