Last active
August 29, 2015 14:01
-
-
Save samvasko/a18d4404eca0300a4b9d to your computer and use it in GitHub Desktop.
Gulp + Browserify + Watchify setup
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
var gulp = require('gulp'); | |
var watchify = require('watchify'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var gutil = require('gulp-util'); | |
gulp.task('editor', function () { | |
var b = browserify(); | |
b.require('./sources/js/scribe.js', {expose: 'scribe'}); | |
b.transform({global: true}, 'deamdify'); | |
b.bundle() | |
.pipe(source('scribe.js')) | |
.pipe(gulp.dest('./public/js')); | |
}); | |
gulp.task('scripts', function () { | |
var b = watchify('./sources/js/main.js'); | |
b.exclude('scribe'); | |
b.on('update', rebundle); | |
function rebundle () { | |
return b.bundle() | |
.on('error', gutil.log) | |
.pipe(source('main.js')) | |
.pipe(gulp.dest('./public/js/')); | |
} | |
return rebundle(); | |
}); |
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
module.exports = { | |
Scribe: require('scribe-editor'), | |
// | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You beautiful human being, thanks for publishing this! I was missing
{global: true}
and going round in circles.