Last active
August 29, 2015 14:12
-
-
Save johntron/1c057bbad6d477362ab6 to your computer and use it in GitHub Desktop.
Gulpfile using Duo to build scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage: