-
Notifications
You must be signed in to change notification settings - Fork 1
/
Sakefile
64 lines (51 loc) · 1.42 KB
/
Sakefile
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use 'sake-bundle'
use 'sake-linked'
use 'sake-outdated'
use 'sake-test'
use 'sake-version'
use 'sake-publish',
deploy:
remote: 'origin'
refspec: 'master:master'
npm: false
task 'build', 'build project', ['build:static', 'build:js']
task 'build-min', 'build minified project', ['build:static', 'build-min:js']
task 'build:js', 'build js', ->
return if (running 'build')
bundle.write
entry: 'src/js/app.coffee'
output: 'public/js/app.js'
cache: false
format: 'web'
commonjs: true
external: false
compilers:
coffee:
version: 2
.catch (err) ->
console.error err
task 'build-min:js', 'build minified js', ['build'], ->
exec '''
uglifyjs public/js/app.js -o public/js/app.min.js
cp public/js/app.min.js public/js/app.js
'''
task 'build:static', 'build static assets', ->
exec '''
mkdir -p public/css
mkdir -p public/js
bebop compile'
'''
task 'watch', 'watch for changes and rebuild project', ['build:js', 'watch:js', 'watch:static']
task 'watch:js', 'watch js for changes and rebuild', ->
build = (filename) ->
return if (running 'build')
console.log filename, 'modified'
invoke 'build:js'
watch 'src/*', build
watch 'node_modules/*', build
task 'watch:static', 'watch static files and rebuild', ['build:static'], ->
exec 'bebop'
task 'start', 'start server', ['build'], ->
exec '''
coffee ./server.coffee
'''