Last active
August 29, 2015 14:16
-
-
Save terakilobyte/491f4e3916f2bdd5ee97 to your computer and use it in GitHub Desktop.
browserify help
This file contains 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 paths = { | |
main: './client/client.js', | |
jsx: './common/components/**/*.jsx', | |
publicJs: './public/js', | |
server: './server/server.js', | |
serverIgnore: [ | |
'gulpfile.js', | |
'public/', | |
'components/**/*.styl', | |
'bower_components/', | |
'node_modules/' | |
], | |
syncWatch: [ | |
'public/**/*.*', | |
'!public/js/bundle.js' | |
] | |
}; | |
var b = browserify(config); | |
bundleLogger.start('bundle.js'); | |
b.transform(envify({ | |
NODE_ENV: 'development' | |
})); | |
b = watchify(b); | |
b.on('update', function() { | |
bundleItUp(b); | |
}); | |
b.on('time', function(time) { | |
if (!called) { | |
called = true; | |
cb(); | |
} | |
debug('bundle completed in %s ms', time); | |
_reload(); | |
}); | |
b.on('error', function(e) { | |
debug('bundler error', e); | |
}); | |
b.add(paths.main); | |
bundleItUp(b); | |
} | |
function bundleItUp(b) { | |
debug('Bundling'); | |
return b.bundle() | |
.on('error', handleErrors) | |
.pipe(bundleName('bundle.js')) | |
.pipe(gulp.dest(paths.publicJs)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment