-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
36 lines (27 loc) · 1 KB
/
Cakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
fs = require 'fs'
{exec} = require 'child_process'
sty = require 'sty'
# compile
compile = (type, description, script) ->
task "compile:#{type}", description, ->
exec script, (err, output) ->
if err
console.log sty.red(err)
else
console.log sty.green("#{type} compiled")
compile 'jade', 'compile jade to html', 'jade -O public src/jade/index.jade'
compile 'coffee', 'compile coffee-script to javascript', 'coffee -bo public/js -c src/coffee/*.coffee'
compile 'stylus', 'compile stylus to css', 'stylus -u nib -o public/css/ -c src/styl/main.styl'
task 'compile', 'compile all source codes', ->
invoke 'compile:jade'
invoke 'compile:stylus'
invoke 'compile:coffee'
# watch
task 'watch', 'watch file changes and auto run compile tasks', ->
invoke 'compile'
fs.watch './src/coffee', (event, filename) ->
invoke 'compile:coffee'
fs.watch './src/styl', (event, filename) ->
invoke 'compile:stylus'
fs.watch './src/jade', (event, filename) ->
invoke 'compile:jade'