Skip to content

Instantly share code, notes, and snippets.

@rpazyaquian
Created December 1, 2014 17:22
Show Gist options
  • Save rpazyaquian/561aaecb5487c2e10782 to your computer and use it in GitHub Desktop.
Save rpazyaquian/561aaecb5487c2e10782 to your computer and use it in GitHub Desktop.
nerve-gulpfile () {
echo "// using https://github.com/gulpjs/gulp/blob/master/docs/recipes/fast-browserify-builds-with-watchify.md
var gulp = require('gulp');
// browserify + watchify
var browserify = require('browserify');
var watchify = require('watchify');
// other stuff for watchify
var source = require('vinyl-source-stream');
var gutil = require('gulp-util');
// react
var reactify = require('reactify');
gulp.task('react-watch', function() {
// vOv just go with it
// assumes your scripts live in /src/
var bundler = watchify(browserify('./app/jsx/main.jsx', watchify.args)
.transform(reactify));
// bundler.transform('brfs');
bundler.on('update', rebundle);
function rebundle() {
return bundler.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('bundle.js'))
.pipe(gulp.dest('./app/scripts'));
}
return rebundle();
});"
}
nerve-init () {
echo "Building Nerve scaffold..."
git init
touch .gitignore
echo "node_modules" > .gitignore
npm init
npm install --save-dev gulp
npm install --save-dev react
npm install --save-dev backbone
npm install --save-dev browserify
npm install --save-dev watchify
npm install --save-dev reactify
npm install --save-dev vinyl-source-stream
npm install --save-dev gulp-util
touch gulpfile.js
nerve-gulpfile > gulpfile.js
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment