Skip to content

Instantly share code, notes, and snippets.

@jwebcat
Created October 23, 2014 01:11
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/9ca388cf58262f444dc8 to your computer and use it in GitHub Desktop.
Save jwebcat/9ca388cf58262f444dc8 to your computer and use it in GitHub Desktop.
this is to run duo with gulp
/**
* Module Dependencies
*/
var map = require('map-stream');
var Duo = require('../../');
var gulp = require('gulp');
/**
* Default
*/
gulp.task('default', ['scripts', 'styles']);
/**
* Scripts
*/
gulp.task('scripts', function() {
gulp.src('home.js')
.pipe(duo())
.pipe(gulp.dest('build'))
})
/**
* Styles
*/
gulp.task('styles', function() {
gulp.src('home.css')
.pipe(duo())
.pipe(gulp.dest('build'))
})
/**
* Duo
*/
function duo(opts) {
opts = opts || {};
return map(function(file, fn) {
Duo(file.base)
.entry(file.path)
.run(function(err, src) {
if (err) return fn(err);
file.contents = new Buffer(src);
fn(null, file);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment