diff options
Diffstat (limited to 'Gruntfile.js')
-rw-r--r-- | Gruntfile.js | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index 86612dc4..b80ab56d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js | |||
@@ -3,8 +3,9 @@ module.exports = function (grunt) { | |||
3 | 3 | ||
4 | grunt.initConfig({ | 4 | grunt.initConfig({ |
5 | appDir: 'app/Resources/static', | 5 | appDir: 'app/Resources/static', |
6 | buildDir: 'web/bundles/wallabagcore', | 6 | buildDir: 'app/Resources/build', |
7 | modulesDir: 'node_modules', | 7 | modulesDir: 'node_modules', |
8 | releaseDir: 'web/bundles/wallabagcore', | ||
8 | 9 | ||
9 | postcss: { | 10 | postcss: { |
10 | material: { | 11 | material: { |
@@ -20,7 +21,7 @@ module.exports = function (grunt) { | |||
20 | ], | 21 | ], |
21 | }, | 22 | }, |
22 | src: '<%= buildDir %>/material.css', | 23 | src: '<%= buildDir %>/material.css', |
23 | dest: '<%= buildDir %>/themes/material/css/style.min.css', | 24 | dest: '<%= releaseDir %>/themes/material/css/style.min.css', |
24 | }, | 25 | }, |
25 | baggy: { | 26 | baggy: { |
26 | options: { | 27 | options: { |
@@ -35,7 +36,7 @@ module.exports = function (grunt) { | |||
35 | ], | 36 | ], |
36 | }, | 37 | }, |
37 | src: '<%= buildDir %>/baggy.css', | 38 | src: '<%= buildDir %>/baggy.css', |
38 | dest: '<%= buildDir %>/themes/baggy/css/style.min.css', | 39 | dest: '<%= releaseDir %>/themes/baggy/css/style.min.css', |
39 | }, | 40 | }, |
40 | }, | 41 | }, |
41 | concat: { | 42 | concat: { |
@@ -92,7 +93,7 @@ module.exports = function (grunt) { | |||
92 | uglify: { | 93 | uglify: { |
93 | material: { | 94 | material: { |
94 | files: { | 95 | files: { |
95 | '<%= buildDir %>/themes/material/js/material.min.js': | 96 | '<%= releaseDir %>/themes/material/js/material.min.js': |
96 | ['<%= buildDir %>/material.browser.js'], | 97 | ['<%= buildDir %>/material.browser.js'], |
97 | }, | 98 | }, |
98 | options: { | 99 | options: { |
@@ -101,7 +102,7 @@ module.exports = function (grunt) { | |||
101 | }, | 102 | }, |
102 | baggy: { | 103 | baggy: { |
103 | files: { | 104 | files: { |
104 | '<%= buildDir %>/themes/baggy/js/baggy.min.js': | 105 | '<%= releaseDir %>/themes/baggy/js/baggy.min.js': |
105 | ['<%= buildDir %>/baggy.browser.js'], | 106 | ['<%= buildDir %>/baggy.browser.js'], |
106 | }, | 107 | }, |
107 | options: { | 108 | options: { |
@@ -122,30 +123,25 @@ module.exports = function (grunt) { | |||
122 | src: 'annotator.min.js', | 123 | src: 'annotator.min.js', |
123 | dest: '<%= buildDir %>/themes/_global/js/', | 124 | dest: '<%= buildDir %>/themes/_global/js/', |
124 | }, | 125 | }, |
125 | }, | ||
126 | symlink: { | ||
127 | baggyfonts: { | 126 | baggyfonts: { |
128 | files: [ | 127 | files: [ |
129 | { | 128 | { |
130 | expand: true, | 129 | expand: true, |
131 | overwrite: true, | ||
132 | cwd: '<%= modulesDir %>/icomoon-free-npm/Font', | 130 | cwd: '<%= modulesDir %>/icomoon-free-npm/Font', |
133 | src: 'IcoMoon-Free.ttf', | 131 | src: 'IcoMoon-Free.ttf', |
134 | dest: '<%= buildDir %>/themes/baggy/fonts/', | 132 | dest: '<%= releaseDir %>/themes/baggy/fonts/', |
135 | }, | 133 | }, |
136 | { | 134 | { |
137 | expand: true, | 135 | expand: true, |
138 | overwrite: true, | ||
139 | cwd: '<%= modulesDir %>/ptsans-npm-webfont/fonts', | 136 | cwd: '<%= modulesDir %>/ptsans-npm-webfont/fonts', |
140 | src: '*', | 137 | src: 'ptsansbold.woff', |
141 | dest: '<%= buildDir %>/themes/baggy/fonts/', | 138 | dest: '<%= releaseDir %>/themes/baggy/fonts/', |
142 | }, | 139 | }, |
143 | { | 140 | { |
144 | expand: true, | 141 | expand: true, |
145 | overwrite: true, | ||
146 | cwd: '<%= modulesDir %>/material-design-icons-iconfont/dist/fonts/', | 142 | cwd: '<%= modulesDir %>/material-design-icons-iconfont/dist/fonts/', |
147 | src: '*', | 143 | src: ['MaterialIcons-Regular.eot', 'MaterialIcons-Regular.woff2', 'MaterialIcons-Regular.woff', 'MaterialIcons-Regular.ttf'], |
148 | dest: '<%= buildDir %>/themes/baggy/fonts/', | 144 | dest: '<%= releaseDir %>/themes/baggy/fonts/', |
149 | }, | 145 | }, |
150 | ], | 146 | ], |
151 | }, | 147 | }, |
@@ -156,31 +152,26 @@ module.exports = function (grunt) { | |||
156 | overwrite: true, | 152 | overwrite: true, |
157 | cwd: '<%= modulesDir %>/icomoon-free-npm/Font', | 153 | cwd: '<%= modulesDir %>/icomoon-free-npm/Font', |
158 | src: 'IcoMoon-Free.ttf', | 154 | src: 'IcoMoon-Free.ttf', |
159 | dest: '<%= buildDir %>/themes/material/fonts', | 155 | dest: '<%= releaseDir %>/themes/material/fonts', |
160 | }, | ||
161 | { | ||
162 | expand: true, | ||
163 | overwrite: true, | ||
164 | cwd: '<%= modulesDir %>/materialize-css/', | ||
165 | src: 'font', | ||
166 | dest: '<%= buildDir %>/themes/material', | ||
167 | }, | 156 | }, |
168 | { | 157 | { |
169 | expand: true, | 158 | expand: true, |
170 | overwrite: true, | 159 | overwrite: true, |
171 | cwd: '<%= modulesDir %>/roboto-fontface/fonts/Roboto', | 160 | cwd: '<%= modulesDir %>/roboto-fontface/fonts/Roboto', |
172 | src: '*', | 161 | src: '*', |
173 | dest: '<%= buildDir %>/themes/material/fonts/', | 162 | dest: '<%= releaseDir %>/themes/material/font/roboto', |
174 | }, | 163 | }, |
175 | { | 164 | { |
176 | expand: true, | 165 | expand: true, |
177 | overwrite: true, | 166 | overwrite: true, |
178 | cwd: '<%= modulesDir %>/material-design-icons-iconfont/dist/fonts/', | 167 | cwd: '<%= modulesDir %>/material-design-icons-iconfont/dist/fonts/', |
179 | src: '*', | 168 | src: ['MaterialIcons-Regular.eot', 'MaterialIcons-Regular.woff2', 'MaterialIcons-Regular.woff', 'MaterialIcons-Regular.ttf'], |
180 | dest: '<%= buildDir %>/themes/material/fonts/', | 169 | dest: '<%= releaseDir %>/themes/material/fonts/', |
181 | }, | 170 | }, |
182 | ], | 171 | ], |
183 | }, | 172 | }, |
173 | }, | ||
174 | symlink: { | ||
184 | pics: { | 175 | pics: { |
185 | files: [ | 176 | files: [ |
186 | { | 177 | { |
@@ -188,7 +179,7 @@ module.exports = function (grunt) { | |||
188 | overwrite: true, | 179 | overwrite: true, |
189 | cwd: '<%= appDir %>/themes/_global/', | 180 | cwd: '<%= appDir %>/themes/_global/', |
190 | src: 'img', | 181 | src: 'img', |
191 | dest: '<%= buildDir %>/themes/_global/', | 182 | dest: '<%= releaseDir %>/themes/_global/', |
192 | }, | 183 | }, |
193 | ], | 184 | ], |
194 | }, | 185 | }, |
@@ -203,13 +194,23 @@ module.exports = function (grunt) { | |||
203 | all: { | 194 | all: { |
204 | src: ['./<%= buildDir %>'], | 195 | src: ['./<%= buildDir %>'], |
205 | }, | 196 | }, |
197 | release: { | ||
198 | src: ['./<%= releaseDir %>/*'], | ||
199 | } | ||
206 | }, | 200 | }, |
201 | eslint: { | ||
202 | target: ['<%= appDir %>/themes/material/js/init.js', '<%= appDir %>/themes/baggy/js/init.js'] | ||
203 | }, | ||
204 | stylelint: { | ||
205 | target: ['<%= appDir %>/themes/material/css/*.css', '<%= appDir %>/themes/baggy/css/*.css'] | ||
206 | } | ||
207 | |||
207 | }); | 208 | }); |
208 | 209 | ||
209 | grunt.registerTask( | 210 | grunt.registerTask( |
210 | 'fonts', | 211 | 'fonts', |
211 | 'Install fonts', | 212 | 'Install fonts', |
212 | ['symlink:baggyfonts', 'symlink:materialfonts'] | 213 | ['copy:baggyfonts', 'copy:materialfonts'] |
213 | ); | 214 | ); |
214 | 215 | ||
215 | grunt.registerTask( | 216 | grunt.registerTask( |
@@ -221,7 +222,7 @@ module.exports = function (grunt) { | |||
221 | grunt.registerTask( | 222 | grunt.registerTask( |
222 | 'default', | 223 | 'default', |
223 | 'Build and install everything', | 224 | 'Build and install everything', |
224 | ['clean', 'copy:pickerjs', 'concat', 'browserify', 'uglify', 'postcss', 'symlink'] | 225 | ['clean', 'copy:pickerjs', 'concat', 'browserify', 'uglify', 'postcss', 'copy', 'symlink'] |
225 | ); | 226 | ); |
226 | 227 | ||
227 | grunt.registerTask( | 228 | grunt.registerTask( |
@@ -229,4 +230,10 @@ module.exports = function (grunt) { | |||
229 | 'Compiles the stylesheets.', | 230 | 'Compiles the stylesheets.', |
230 | ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss'] | 231 | ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss'] |
231 | ); | 232 | ); |
233 | |||
234 | grunt.registerTask( | ||
235 | 'tests', | ||
236 | 'Test css and js style conformity', | ||
237 | ['eslint', 'stylelint', 'default'] | ||
238 | ) | ||
232 | }; | 239 | }; |