Last active
December 10, 2015 11:30
-
-
Save pnlybubbles/db03a89d163b22fe0573 to your computer and use it in GitHub Desktop.
gulpfile.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp = require 'gulp' | |
plumber = require 'gulp-plumber' | |
coffee = require 'gulp-coffee' | |
coffee_react = require 'gulp-cjsx' | |
watchify = require 'gulp-watchify' | |
rename = require 'gulp-rename' | |
uglify = require 'gulp-uglify' | |
sourcemaps = require 'gulp-sourcemaps' | |
buffer = require 'vinyl-buffer' | |
gulp.task 'default', ['build'] | |
gulp.task 'build', [ | |
'build:coffee', | |
'build:cjsx' | |
] | |
gulp.task 'build:coffee', -> | |
gulp | |
.src 'src/**/*.coffee' | |
.pipe plumber() | |
.pipe coffee() | |
.pipe gulp.dest('lib') | |
gulp.task 'build:cjsx', -> | |
gulp | |
.src 'src/**/*.cjsx' | |
.pipe plumber() | |
.pipe coffee_react() | |
.pipe gulp.dest('lib') | |
watching = false | |
gulp.task 'enable-watch-mode', -> watching = true | |
gulp.task 'browserify', watchify (watchify) -> | |
gulp | |
.src 'lib/main.js' | |
.pipe watchify | |
watch: watching | |
debug: true | |
.pipe buffer() | |
.pipe sourcemaps.init | |
loadMaps: true | |
.pipe uglify() | |
.pipe rename('bundle.js') | |
.pipe sourcemaps.write('./') | |
.pipe gulp.dest('public/js') | |
gulp.task 'watchify', ['enable-watch-mode', 'browserify'] | |
gulp.task 'watch', ['build', 'enable-watch-mode', 'watchify'], -> | |
gulp.watch 'src/**/*.coffee', ['build:coffee'] | |
gulp.watch 'src/**/*.cjsx', ['build:cjsx'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment