forked from stoodder/finchjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.coffee
106 lines (91 loc) · 2.18 KB
/
Gruntfile.coffee
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
###
#=================================================
#
# Setup
#
#=================================================
Install Ruby
Install Node.js (http://nodejs.org/)
npm install -g grunt-cli
npm install coffee-script
npm install grunt --save-dev
npm install grunt-contrib-coffee --save-dev
npm install grunt-contrib-uglify --save-dev
npm install grunt-contrib-watch --save-dev
###
module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-contrib-coffee')
grunt.loadNpmTasks('grunt-contrib-uglify')
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.registerTask('default', [
'coffee:banner'
'update_banner'
'coffee:dist'
'uglify:dist'
'coffee:test'
'watch'
])
grunt.registerTask 'update_banner', 'updates the banner information', ->
try
banner = grunt.file.read('scripts/banner.js').toString()
catch e
banner = ""
#END try
uglfiy_cfg = grunt.config('uglify')
uglfiy_cfg.dist.options.banner = banner
grunt.config('uglify', uglfiy_cfg)
#END registerTask
grunt.initConfig
'pkg': grunt.file.readJSON('package.json')
'coffee':
'banner':
options:
bare: true
#END options
files:
'scripts/banner.js': ["coffee/banner.coffee"]
#END files
#END banner
'dist':
options:
join: true
#END options
files:
'<%= pkg.name %>.js': [
"coffee/banner.coffee"
"coffee/<%= pkg.name %>.coffee"
]
#END files
#END coffee:dist
'test':
files:
"tests/tests.js": "tests/tests.coffee"
#END files
#END coffee:test
#END coffee
'uglify':
'dist':
options:
'banner': '' #Updated lated in the update_banner task
#END options
files:
'<%= pkg.name %>.min.js': '<%= pkg.name %>.js'
#END files
#END uglifY:dist
#END uglify
'watch':
'banner_coffee':
'files': ["coffee/banner.coffee"]
'tasks': ['coffee:banner', 'update_banner', 'coffee:dist', 'uglify:dist']
#END watch:banner_coffee
'dist_coffee':
'files': ["coffee/<%= pkg.name %>.coffee"]
'tasks': ['coffee:dist', 'uglify:dist']
#END watch:dist_coffee
'test_coffee':
'files': ['tests/tests.coffee']
'tasks': ['coffee:test']
#END watch:test_coffee
#END watch
#END initConfig
#END exports