Skip to content

Instantly share code, notes, and snippets.

@cvan
Created September 12, 2014 21:50
Show Gist options
  • Save cvan/f89a9d18310a7af28898 to your computer and use it in GitHub Desktop.
Save cvan/f89a9d18310a7af28898 to your computer and use it in GitHub Desktop.
using duo with gulp
var duo = require('duo'); // https://github.com/duojs/duo
var map = require('map-stream'); // https://github.com/dominictarr/map-stream
var paths = {
build: {
src: {
jsApp: ['./src/js/main.js'],
jsClient: ['./src/js/client.js']
},
dest: {
js: './src'
}
}
};
gulp.task('js-build', function () {
gulp.src(paths.build.src.jsApp)
.pipe(duoify())
.pipe(gulp.dest(paths.build.dest.js));
gulp.src(paths.build.src.jsClient)
.pipe(duoify())
.pipe(gulp.dest(paths.build.dest.js));
});
function duoify(opts) {
opts = opts || {};
return map(function (file, cb) {
duo(__dirname)
.entry(file.path)
.run(function (err, src) {
if (err) {
return cb(err);
}
file.contents = new Buffer(src);
cb(null, file);
});
});
}
@tinchoz49
Copy link

this is nice! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment