Skip to content

Instantly share code, notes, and snippets.

@yocontra
Last active August 29, 2015 14:04
Show Gist options
  • Save yocontra/1354af0114783766ba5e to your computer and use it in GitHub Desktop.
Save yocontra/1354af0114783766ba5e to your computer and use it in GitHub Desktop.
use pipelines with gulp
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var uglify = require('gulp-uglify');
gulp.task('index', function(){
var bundler = browserify('newstimeline/livescript/index.ls');
bundler.transform('browserify-livescript');
return bundler.bundle({insertGlobals: true})
.pipe(source('index.js'))
.pipe(buffer())
.pipe(uglify()) // just an example, remove if you dont need it
.pipe(gulp.dest('newstimeline/static/js'));
});
gulp.task('management', function(){
var bundler = browserify('newstimeline/livescript/management.ls');
bundler.transform('browserify-livescript');
return bundler.bundle({insertGlobals: true})
.pipe(source('management.js'))
.pipe(buffer())
.pipe(uglify()) // just an example, remove if you dont need it
.pipe(gulp.dest('newstimeline/static/js'));
});
gulp.task('default', ['index', 'management']);
var gulp = require('gulp');
var ls = require('gulp-livescript');
var browserify = require('gulp-browserify');
gulp.task('ls', function() {
return gulp.src('newstimeline/livescript/*.js')
.pipe(ls({bare: true}))
.pipe(gulp.dest('build/js/'))
});
gulp.task('index', ['ls'], function() {
return gulp.src('build/js/index.js')
.pipe(browserify({insertGlobals : true}))
.pipe(gulp.dest('newstimeline/static/js/'))
});
gulp.task('management', ['ls'], function() {
return gulp.src('build/js/management.js')
.pipe(browserify({insertGlobals : true}))
.pipe(gulp.dest('newstimeline/static/js/'))
});
gulp.task('default', ['index', 'management']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment