Skip to content

Instantly share code, notes, and snippets.

@ryoppy
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryoppy/00e5646b0f0dc5b6615b to your computer and use it in GitHub Desktop.
Save ryoppy/00e5646b0f0dc5b6615b to your computer and use it in GitHub Desktop.
coffee, file-include, watch (could be resolved an unexpected react)
gulp = require('gulp')
fileinclude = require('gulp-file-include')
coffee = require('gulp-coffee')
runSequence = require('run-sequence')
app = 'app'
paths =
fileinclude:
in : ["#{app}/**/*.coffee", "!#{app}/.tmp"]
out : "#{app}/.tmp"
coffee:
in : ["#{app}/.tmp/*.coffee"]
out : 'public/dist'
gulp.task 'fileinclude', ->
gulp.src paths.fileinclude.in
.pipe fileinclude
prefix: '@@'
basepath: '@file'
.pipe gulp.dest paths.fileinclude.out
gulp.task 'coffee', ['fileinclude'], ->
gulp.src paths.coffee.in
.pipe coffee()
.pipe gulp.dest paths.coffee.out
# watching..
# vi foo.coffee
# (detect!) foo.coffee, bar.coffee -> concated.coffee
# (detect!) concated.coffee <- !?
gulp.task 'watch', ['build'], ->
s = false
gulp.watch "#{app}/**/*"
.on 'change', (e) ->
unless s
console.log "changed #{e.path}"
s = true
runSequence 'coffee', -> s = false
gulp.task 'build', ['coffee']
gulp.task 'default', ['watch']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment