Skip to content

Instantly share code, notes, and snippets.

@johntron
Last active August 29, 2015 14:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johntron/1c057bbad6d477362ab6 to your computer and use it in GitHub Desktop.
Save johntron/1c057bbad6d477362ab6 to your computer and use it in GitHub Desktop.
Gulpfile using Duo to build scripts
/*jslint node: true, sloppy:true */
var gulp = require('gulp'),
Duo = require('duo'),
through = require('through2'),
paths = {
scripts: ['src/boot.js'],
styles: ['src/*.css', 'src/**/*.css'],
images: ['src/*.png', 'src/**/*.png']
};
function duo() {
return through.obj(function (file, enc, done) {
var build = new Duo(__dirname);
build.development(true);
build.installTo('vendor/');
build.entry(file.path);
build.run(function (err, src) {
if (err) {
return done(err);
}
file.contents = new Buffer(src, 'utf8');
return done(null, file);
});
});
}
gulp.task('scripts', function () {
gulp.src(paths.scripts)
.pipe(duo())
.pipe(gulp.dest('static/'));
});
gulp.task('default', ['scripts']);
@johntron
Copy link
Author

johntron commented Jan 7, 2015

usage:

gulp

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