Skip to content

Instantly share code, notes, and snippets.

@jwebcat
Created October 23, 2014 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwebcat/f1e72c64b90fe23540b0 to your computer and use it in GitHub Desktop.
Save jwebcat/f1e72c64b90fe23540b0 to your computer and use it in GitHub Desktop.
another version of gulp with duo
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);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment