ed895a01 by Adam Heath

Image support.:w

1 parent 0e5fb378
...@@ -42,12 +42,8 @@ module.exports = function (grunt) { ...@@ -42,12 +42,8 @@ module.exports = function (grunt) {
42 }; 42 };
43 if (common.useRev) { 43 if (common.useRev) {
44 initConfig.rev = { 44 initConfig.rev = {
45 css: { 45 dist: {
46 files: { 46 files: [],
47 src: _.map(common.css.options.dirs, function (value) {
48 return 'dist/' + value + '/{,**/}*.css';
49 }),
50 }
51 }, 47 },
52 }; 48 };
53 } 49 }
...@@ -216,29 +212,91 @@ module.exports = function (grunt) { ...@@ -216,29 +212,91 @@ module.exports = function (grunt) {
216 }; 212 };
217 } 213 }
218 214
219 initConfig.copy.css = { 215 if (common.css) {
220 files: [{ 216 initConfig.copy.css = {
221 expand: true, 217 files: [{
222 dot: true, 218 expand: true,
223 cwd: 'src', 219 dot: true,
224 dest: '.grunt/usemin-css/', 220 cwd: 'src',
225 src: _.map(common.css.options.dirs, function (value) { 221 dest: '.grunt/usemin-css/',
226 return value + '/{,**/}*.css'; 222 src: _.map(common.css.options.dirs, function (value) {
227 }), 223 return value + '/{,**/}*.css';
228 }] 224 }),
229 }; 225 }]
230 initConfig.clean.dist.files[0].src.push('.grunt/usemin-css'); 226 };
231 initConfig.usemin.css = _.map(common.css.options.dirs, function (value) { 227 initConfig.clean.dist.files[0].src.push('.grunt/usemin-css');
232 return 'dist/' + value + '/{,**/}*.css'; 228 initConfig.usemin.css = _.map(common.css.options.dirs, function (value) {
233 }); 229 return 'dist/' + value + '/{,**/}*.css';
230 });
231 if (common.useRev) {
232 initConfig.rev.css = {
233 files: {
234 src: _.map(common.css.options.dirs, function (value) {
235 return 'dist/' + value + '/{,**/}*.css';
236 }),
237 }
238 };
239 }
240 }
241
242 if (common.images) {
243 initConfig.imagemin = {
244 dist: {
245 files: _.map(common.images.options.dirs, function (value) {
246 return {
247 expand: true,
248 cwd: 'src/' + value,
249 src: '{,**/}*.{gif,jpeg,jpg,png}',
250 dest: 'dist/' + value,
251 };
252 }),
253 }
254 };
255 initConfig.svgmin = {
256 dist: {
257 files: _.map(common.images.options.dirs, function (value) {
258 return {
259 expand: true,
260 cwd: 'src/' + value,
261 src: '{,**/}*.svg',
262 dest: 'dist/' + value,
263 };
264 }),
265 }
266 };
267 initConfig.copy.img = {
268 files: [{
269 expand: true,
270 dot: true,
271 cwd: 'src',
272 dest: 'dist',
273 src: _.map(common.images.options.dirs, function (value) {
274 return value + '/{,**/}*.*';
275 }),
276 }]
277 };
278 if (common.useRev) {
279 initConfig.rev.img = {
280 files: {
281 src: _.map(common.images.options.dirs, function (value) {
282 return 'dist/' + value + '/{,**/}*.{gif,jpeg,jpg,png,webp}';
283 }),
284 }
285 };
286 }
287 }
234 288
235 buildList.push('useminPrepare'); // html 289 buildList.push('useminPrepare'); // html
236 //buildList.push('usemin:views' 290 //buildList.push('usemin:views'
237 //buildList.push('requirejs'); // script 291 //buildList.push('requirejs'); // script
238 buildList.push('copy:css'); // css 292 buildList.push('copy:css'); // css
239 //buildList.push('imagemin'); // image 293 if (common.images) {
240 //buildList.push('svgmin'); // image 294 buildList.push('imagemin'); // image
241 //buildList.push('rev:img'); // image 295 buildList.push('svgmin'); // image
296 if (common.useRev) {
297 buildList.push('rev:img'); // image
298 }
299 }
242 //buildList.push('autoprefixer'); // css 300 //buildList.push('autoprefixer'); // css
243 //buildList.push('concat:requirejs'); // montyPython 301 //buildList.push('concat:requirejs'); // montyPython
244 buildList.push('concat:generated'); // montyPython 302 buildList.push('concat:generated'); // montyPython
...@@ -247,8 +305,8 @@ module.exports = function (grunt) { ...@@ -247,8 +305,8 @@ module.exports = function (grunt) {
247 buildList.push('copy:dist'); 305 buildList.push('copy:dist');
248 //'modernizr'); 306 //'modernizr');
249 //buildList.push('uglify:generated'); // montyPython 307 //buildList.push('uglify:generated'); // montyPython
250 //'rev:dist'); // montyPython
251 if (common.useRev) { 308 if (common.useRev) {
309 buildList.push('rev:dist'); // montyPython
252 buildList.push('rev:css'); // montyPython 310 buildList.push('rev:css'); // montyPython
253 } 311 }
254 //buildList.push('revconfig'); // montyPython 312 //buildList.push('revconfig'); // montyPython
......
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
23 "grunt-contrib-cssmin": "~0.12.3", 23 "grunt-contrib-cssmin": "~0.12.3",
24 "grunt-contrib-jshint": "~0", 24 "grunt-contrib-jshint": "~0",
25 "grunt-contrib-htmlmin": "~0", 25 "grunt-contrib-htmlmin": "~0",
26 "grunt-contrib-imagemin": "~0",
26 "grunt-rev": "~0", 27 "grunt-rev": "~0",
28 "grunt-svgmin": "~0",
27 "grunt-usemin": "~2", 29 "grunt-usemin": "~2",
28 "lodash": "~2", 30 "lodash": "~2",
29 "punch": "~0.5.46", 31 "punch": "~0.5.46",
......