Skip to content

Instantly share code, notes, and snippets.

@tanaka51
Created March 25, 2015 15:13
Show Gist options
  • Select an option

  • Save tanaka51/b2c255a9933cf6e9f5e2 to your computer and use it in GitHub Desktop.

Select an option

Save tanaka51/b2c255a9933cf6e9f5e2 to your computer and use it in GitHub Desktop.

Revisions

  1. Koichi Tanaka created this gist Mar 25, 2015.
    26 changes: 26 additions & 0 deletions gulpfile.coffee
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    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']