Skip to content

Instantly share code, notes, and snippets.

@pnlybubbles
Created October 1, 2015 12:31
Show Gist options
  • Save pnlybubbles/35b32a93c77c44f2312b to your computer and use it in GitHub Desktop.
Save pnlybubbles/35b32a93c77c44f2312b to your computer and use it in GitHub Desktop.
よく使うgulpfileのメモ
gulp = require 'gulp'
watchify = require 'gulp-watchify'
sourcemaps = require 'gulp-sourcemaps'
buffer = require 'vinyl-buffer'
plumber = require 'gulp-plumber'
rename = require 'gulp-rename'
target =
src: 'index.coffee'
name: 'index.js'
dest: ''
bundleExternal: true
detectGlobals: true
gulp.task 'default', ['build']
gulp.task 'build', watchify (watchify) ->
gulp
.src target.src
.pipe plumber()
.pipe watchify
watch: watching
extensions: ['.coffee', '.js']
debug: true
transform: ['coffeeify']
detectGlobals: target.detectGlobals
bundleExternal: target.bundleExternal
.pipe buffer()
.pipe sourcemaps.init
loadMaps: true
.pipe rename(target.name)
.pipe sourcemaps.write('./')
.pipe gulp.dest(target.dest)
watching = false
gulp.task 'enable-watch-mode', -> watching = true
gulp.task 'watch', ['enable-watch-mode', 'build']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment