-
Notifications
You must be signed in to change notification settings - Fork 23
/
Gruntfile.coffee
179 lines (160 loc) · 4.52 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
directory:
components: "Resources/Private/BowerComponents"
build: "Resources/Public/Build"
source: "Resources/Private/Assets"
############################ Assets ############################
##
# Assets: clean up environment
##
clean:
temporary:
src: [".tmp"]
##
# Assets: copy some files to the distribution dir
##
copy:
gif:
files: [
# includes files within path
expand: true
flatten: true
src: "<%= directory.components %>/fine-uploader/_dist/jquery.fineuploader-*/*.gif"
dest: "<%= directory.build %>"
filter: "isFile"
]
############################ StyleSheets ############################
##
# StyleSheet: minification of CSS
##
cssmin:
options: {}
css:
files: [
src: "<%= sass.css.files[0].dest %>"
dest: ".tmp/cssmin/main.min.css"
]
##
# StyleSheet: compiling to CSS
##
sass:
css:
options:
# output_style = expanded or nested or compact or compressed
style: "expanded"
sourcemap: 'none'
files: [
src: "<%= directory.source %>/StyleSheets/Sass/main.scss"
dest: ".tmp/sass/main.css"
]
############################ JavaScript ############################
##
# JavaScript: check javascript coding guide lines
##
jshint:
files: [
"<%= directory.source %>/JavaScript/*.js"
]
options:
# options here to override JSHint defaults
curly: true
eqeqeq: true
immed: true
latedef: true
newcap: true
noarg: true
sub: true
undef: true
boss: true
eqnull: true
browser: true
loopfunc: true
globals:
jQuery: true
console: true
define: true
alert: true
MediaUpload: true
##
# JavaScript: minimize javascript
##
uglify:
js:
files: [
src: "<%= jshint.files %>"
dest: ".tmp/uglify/MediaUpload.min.js"
]
########## concat css + js ############
concat:
options:
separator: "\n\n"
js:
src: [
"<%= directory.components %>/fine-uploader/dist/jquery.fine-uploader.js"
"<%= jshint.files %>"
]
dest: "<%= directory.build %>/media_upload.js"
js_min:
src: [
"<%= directory.components %>/fine-uploader/dist/jquery.fine-uploader.min.js"
"<%= uglify.js.files[0].dest %>"
]
dest: "<%= directory.build %>/media_upload.min.js"
css:
src: [
"<%= directory.components %>/fine-uploader/dist/fine-uploader.css"
"<%= sass.css.files[0].dest %>"
]
dest: "<%= directory.build %>/media_upload.css"
css_min:
src: [
"<%= directory.components %>/fine-uploader/dist/fine-uploader.min.css"
"<%= cssmin.css.files[0].dest %>"
]
dest: "<%= directory.build %>/media_upload.min.css"
########## Watcher ############
watch:
css:
files: [
"<%= directory.source %>/StyleSheets/**/*.scss"
]
tasks: ["build-css"]
js:
files: ["<%= jshint.files %>"]
tasks: ["build-js"]
########## Help ############
grunt.registerTask "help", "Just display some helping output.", () ->
grunt.log.writeln "Usage:"
grunt.log.writeln ""
grunt.log.writeln "- grunt watch : watch your file and compile as you edit"
grunt.log.writeln "- grunt build : build your assets ready to be deployed"
grunt.log.writeln "- grunt build-css : only build your css files"
grunt.log.writeln "- grunt build-js : only build your js files"
grunt.log.writeln "- grunt build-icons : only build icons"
grunt.log.writeln "- grunt clean : clean behind you the temporary files"
grunt.log.writeln ""
grunt.log.writeln "Use grunt --help for a more verbose description of this grunt."
return
# Load Node module
grunt.loadNpmTasks "grunt-contrib-uglify"
grunt.loadNpmTasks "grunt-contrib-jshint"
grunt.loadNpmTasks "grunt-contrib-watch"
grunt.loadNpmTasks "grunt-contrib-concat"
grunt.loadNpmTasks "grunt-contrib-sass";
grunt.loadNpmTasks "grunt-contrib-cssmin"
grunt.loadNpmTasks "grunt-contrib-copy"
grunt.loadNpmTasks "grunt-contrib-clean"
grunt.loadNpmTasks "grunt-string-replace"
grunt.loadNpmTasks "grunt-imagine"
grunt.loadNpmTasks "grunt-pngmin"
# Alias tasks
grunt.task.renameTask("string-replace", "replace")
# Tasks
grunt.registerTask "build", ["build-js", "build-css", "build-icons"]
grunt.registerTask "build-js", ["jshint", "uglify", "concat:js", "concat:js_min"]
grunt.registerTask "build-css", ["sass", "cssmin", "concat:css", "concat:css_min"]
grunt.registerTask "build-icons", ["copy"]
grunt.registerTask "default", ["help"]
return