Skip to content

Instantly share code, notes, and snippets.

@tanaka51
Created March 25, 2015 15:13
Show Gist options
  • Save tanaka51/b2c255a9933cf6e9f5e2 to your computer and use it in GitHub Desktop.
Save tanaka51/b2c255a9933cf6e9f5e2 to your computer and use it in GitHub Desktop.
gulp = require 'gulp'
util = require 'gulp-util'
source = require 'vinyl-source-stream'
browserify = require 'browserify'
watchify = require 'watchify'
gulp.task 'watch', ->
bundler = watchify browserify
entries: ['./src/index.coffee']
extensions: ['coffee']
transform: ['coffeeify']
debug: true
bundle = ->
util.log 'index.coffee has compiled.'
bundler
.bundle()
.on 'error', (err) -> util.log 'Browserify Error: ', err
.pipe source 'app.js'
.pipe gulp.dest './public'
bundler.on 'update', bundle
bundle()
gulp.task 'default', ['watch']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment