Skip to content

Instantly share code, notes, and snippets.

@polidog
Created July 12, 2014 18:01
Show Gist options
  • Save polidog/0daf6e2371fee3459f57 to your computer and use it in GitHub Desktop.
Save polidog/0daf6e2371fee3459f57 to your computer and use it in GitHub Desktop.
gulpでcoffee,jade,stylusを変換するやつ
# 人生初gulpfile
gulp = require "gulp"
coffee = require "gulp-coffee"
jade = require "gulp-jade"
stylus = require "gulp-stylus"
del = require "del"
paths =
coffee: 'src/coffee/*.coffee'
jade: 'src/jade/*.jade'
stylus: 'src/stylus/*.styl'
dists =
js: 'app/js'
html: 'app'
css: 'app/css'
# 削除タスク
gulp.task 'clean', (cb)->
del ['app'], cb
# Coffeeのコンパイル
gulp.task 'coffee', ->
gulp.src paths.coffee
.pipe coffee bare:true
.pipe gulp.dest dists.js
# Jadeのコンパイル
gulp.task 'jade', ->
gulp.src paths.jade
.pipe jade pretty:true
.pipe gulp.dest dists.html
# stylusのコンパイル
gulp.task 'stylus', ->
gulp.src paths.stylus
.pipe stylus {}
.pipe gulp.dest dists.css
# watch
gulp.task 'watch', ->
gulp.watch paths.coffee, ['coffee']
gulp.watch paths.jade, ['jade']
gulp.watch paths.stylus, ['stylus']
# 起動時の対応
gulp.task 'default', ['clean','coffee','jade','stylus','watch']
@polidog
Copy link
Author

polidog commented Jul 12, 2014

$ gulp --require coffee-script

ってやれば動くはず

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment