/
Gruntfile.coffee
171 lines (168 loc) · 4.92 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
'use strict'
module.exports = (grunt) ->
grunt.initConfig
jshint:
options:
jshintrc: '.jshintrc'
all: [
'Gruntfile.js'
'assets/js/*.js'
'!assets/js/*.min.js'
]
coffeelint:
options:
configFile: '.coffeelintrc'
all: [
'Gruntfile.coffee'
'assets/coffee/*.coffee'
]
coffee:
dist:
options:
sourceMap: true
expand: true
flatten: true
cwd: 'assets/coffee'
src: ['*.coffee']
dest: 'assets/js'
ext: '.js'
sass:
dist:
options:
style: 'compressed'
compass: true
# Source maps are available but require Sass 3.3.0 to be installed
# https://github.com/gruntjs/grunt-contrib-sass#sourcemap
sourcemap: true
files:
'assets/css/main.min.css': [
'assets/sass/main.scss'
]
dev:
options:
style: 'expanded'
compass: true
# Source maps are available, but require Sass 3.3.0 to be installed
# https://github.com/gruntjs/grunt-contrib-sass#sourcemap
sourcemap: true
files:
'assets/css/main.min.css': [
'assets/sass/main.scss'
]
uglify:
dist:
files:
'assets/js/front-page.min.js': [
'vendor/eventEmitter/EventEmitter.js'
'vendor/eventie/eventie.js'
'vendor/imagesloaded/imagesloaded.js'
'vendor/video.js/video.js'
'vendor/BigVideo.js/lib/bigvideo.js'
'assets/js/_front-page.js'
]
'assets/js/scripts.min.js': [
# 'vendor/bootstrap-sass/js/affix.js'
# 'vendor/bootstrap-sass/js/alert.js'
# 'vendor/bootstrap-sass/js/button.js'
# 'vendor/bootstrap-sass/js/carousel.js'
'vendor/bootstrap-sass/js/collapse.js'
'vendor/bootstrap-sass/js/dropdown.js'
# 'vendor/bootstrap-sass/js/modal.js'
# 'vendor/bootstrap-sass/js/popover.js'
# 'vendor/bootstrap-sass/js/scrollspy.js'
# 'vendor/bootstrap-sass/js/tab.js'
# 'vendor/bootstrap-sass/js/tooltip.js'
'vendor/bootstrap-sass/js/transition.js'
'vendor/fitvids/jquery.fitvids.js'
'assets/js/plugins/*.js'
'assets/js/_*.js'
'!assets/js/_front-page.js'
]
options:
# JS source map: to enable, uncomment the lines below and update
# sourceMappingURL based on your install
sourceMap: 'assets/js/scripts.min.js.map'
sourceMappingURL: '/app/themes/roots/assets/js/scripts.min.js.map'
dev:
files:
'<%= uglify.dist.files %>'
options:
# JS source map: to enable, uncomment the lines below and update
# sourceMappingURL based on your install
sourceMap: '<%= uglify.dist.options.sourceMap %>'
sourceMappingURL: '<%= uglify.dist.options.sourceMappingURL %>'
beautify: true
uglify: false
preserveComments: true
mangle: false
grunticon:
icons:
files: [
expand: true
cwd: 'assets/img/icons'
src: ['*.svg', '*.png']
dest: 'assets/img/icons/dist'
]
version:
options:
file: 'lib/scripts.php'
css: 'assets/css/main.min.css'
cssHandle: 'roots_main'
js: 'assets/js/scripts.min.js'
jsHandle: 'roots_scripts'
watch:
sass:
files: ['assets/sass/**/*.scss']
tasks: ['sass:dev', 'version']
coffee:
files: ['<%= coffeelint.all %>']
tasks: ['coffeelint', 'coffee', 'uglify:dev', 'version']
livereload:
# Browser live reloading
# https://github.com/gruntjs/grunt-contrib-watch#live-reloading
options:
livereload: true
files: [
'assets/css/main.min.css'
'assets/js/scripts.min.js'
'templates/*.php'
'*.php'
]
clean:
dist: [
'assets/css/main.min.css'
'assets/js/scripts.min.js'
]
bump:
options:
files: [
'package.json'
'bower.json'
'style.css'
]
commit: false
createTag: false
push: false
# Load tasks
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-jshint'
grunt.loadNpmTasks 'grunt-contrib-uglify'
grunt.loadNpmTasks 'grunt-contrib-watch'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-grunticon'
grunt.loadNpmTasks 'grunt-wp-version'
grunt.loadNpmTasks 'grunt-bump'
# Register tasks
grunt.registerTask "default", [
'clean'
'grunticon:icons'
'coffee'
'sass:dist'
'uglify:dist'
'version'
]
grunt.registerTask "dev", [
'watch'
]