Skip to content

Instantly share code, notes, and snippets.

@yuchan
Created August 14, 2015 18:55
Show Gist options
  • Save yuchan/82027bf3c96ffffa1e9d to your computer and use it in GitHub Desktop.
Save yuchan/82027bf3c96ffffa1e9d to your computer and use it in GitHub Desktop.
Sample Gulpfile for Browserify and React
gulp = require 'gulp'
browserify = require 'browserify'
source = require 'vinyl-source-stream'
reactify = require 'reactify'
watchify = require 'watchify'
_ = require 'lodash'
customOpts =
entries: ['./src/main.js'],
transform: [reactify]
debug: development?
gulp.task 'build', ->
b = browserify customOpts
b.bundle().pipe(source('app.js')).pipe(gulp.dest('./lib'))
gulp.task 'watch', ->
opts = _.assign({}, watchify.args, customOpts)
b = watchify(browserify(opts))
b.bundle().pipe(source('app.js')).pipe(gulp.dest('./lib'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment