-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.coffee
162 lines (118 loc) · 4.29 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json'),
bower:
install:
options:
targetDir: "pre-build/"
layout: "byComponent"
install: true
verbose: true
cleanTargetDir: true
cleanBowerDir: true
# need to run the JQM setup command to install necessary node modules for JQM
shell:
setupjqmnode:
command:['cd pre-build/jquery-mobile',
'npm install'
'echo source files available'
].join('&&')
# need to run the JQM build command to get the resources compiled to dist
buildjqm:
command:['cd pre-build/jquery-mobile',
'grunt dist'
'echo built the jqm distribution'
].join('&&')
# rename JQM css files to my liking
renamecss:
command:['cd assets/css/',
'ren jquery.mobile.min.css jquery-mobile-min.css '
'echo css JQM files renamed'
].join('&&')
# rename JQM JS files to my liking
renamejs:
command:['cd assets/js',
'ren jquery.mobile.min.js jquery-mobile-min.js '
'echo js JQM files renamed'
].join('&&')
# copy over our end distribution resources
copy:
jqmcss:
expand: true
flatten: true
cwd: "pre-build/jquery-mobile/dist/"
src: "jquery.mobile.min.css"
dest: "assets/css/"
jqmjs:
expand: true
flatten: true
cwd: "pre-build/jquery-mobile/dist"
src: "jquery.mobile.min.js"
dest: "assets/js/"
# run a minification process on the jquery file
uglify:
options:
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> -' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
report: "min"
jquery:
src: ["pre-build/jquery/jquery.js"]
dest: "assets/js/jquery-min.js"
less:
development:
src: "resources/custom/less/jqm-custom.less*"
dest: "assets/css/jqm-custom.css"
options:
compress: false
yuicompress: false
optimization: 2
coffee:
allcoffee:
src: "resources/custom/coffee/*.coffee"
dest: "assets/js/app.js"
options:
join: true
bake:
resources:
files: "index.html":"resources/custom/components/base.html"
# lets start up a headless websever with node and connect
connect:
server:
options:
protocol:'http'
port:8000
base:''
# lets watch all the stuff going on for live changes.
watch:
less:
files: ["resources/custom/less/**/*.less"]
tasks: ["less"]
coffee:
files: ["resources/custom/coffee/**/*.coffee"]
tasks: ["coffee"]
bake:
files: ["resources/custom/components/**"]
tasks: ["bake"]
grunt.loadNpmTasks "grunt-shell"
grunt.loadNpmTasks "grunt-contrib-copy"
grunt.loadNpmTasks "grunt-contrib-less"
grunt.loadNpmTasks "grunt-contrib-coffee"
grunt.loadNpmTasks "grunt-bake"
grunt.loadNpmTasks "grunt-contrib-watch"
grunt.loadNpmTasks "grunt-bower-task"
grunt.loadNpmTasks "grunt-contrib-uglify"
grunt.loadNpmTasks "grunt-contrib-connect"
grunt.registerTask "newapp", "copy"
grunt.registerTask "bakeme", "bake"
grunt.registerTask "default", "less coffee bake"
grunt.registerTask('get-jqm', ['bower:install']);
grunt.registerTask('setup-jquery', ['uglify:jquery']);
grunt.registerTask('setup-jqm-node', ['shell:setupjqmnode']);
grunt.registerTask('build-jqm', ['shell:buildjqm']);
grunt.registerTask('build-jqm-css', ['copy:jqmcss']);
grunt.registerTask('build-jqm-js', ['copy:jqmjs']);
grunt.registerTask('rename-jqm-css', ['shell:renamecss']);
grunt.registerTask('rename-jqm-js', ['shell:renamejs']);
# Tak setups and runs the install grunt command for JQM package, setups all the assets, and then fires the watch command start coding.
grunt.registerTask('setup-jqm', ['get-jqm', 'setup-jquery', 'setup-jqm-node', 'build-jqm', 'build-jqm-css', 'build-jqm-js', 'rename-jqm-css', 'rename-jqm-js', 'default']);
grunt.registerTask('default', ['connect', 'watch']);