ed895a01 by Adam Heath

Image support.:w

1 parent 0e5fb378
......@@ -42,12 +42,8 @@ module.exports = function (grunt) {
};
if (common.useRev) {
initConfig.rev = {
css: {
files: {
src: _.map(common.css.options.dirs, function (value) {
return 'dist/' + value + '/{,**/}*.css';
}),
}
dist: {
files: [],
},
};
}
......@@ -216,29 +212,91 @@ module.exports = function (grunt) {
};
}
initConfig.copy.css = {
files: [{
expand: true,
dot: true,
cwd: 'src',
dest: '.grunt/usemin-css/',
src: _.map(common.css.options.dirs, function (value) {
return value + '/{,**/}*.css';
}),
}]
};
initConfig.clean.dist.files[0].src.push('.grunt/usemin-css');
initConfig.usemin.css = _.map(common.css.options.dirs, function (value) {
return 'dist/' + value + '/{,**/}*.css';
});
if (common.css) {
initConfig.copy.css = {
files: [{
expand: true,
dot: true,
cwd: 'src',
dest: '.grunt/usemin-css/',
src: _.map(common.css.options.dirs, function (value) {
return value + '/{,**/}*.css';
}),
}]
};
initConfig.clean.dist.files[0].src.push('.grunt/usemin-css');
initConfig.usemin.css = _.map(common.css.options.dirs, function (value) {
return 'dist/' + value + '/{,**/}*.css';
});
if (common.useRev) {
initConfig.rev.css = {
files: {
src: _.map(common.css.options.dirs, function (value) {
return 'dist/' + value + '/{,**/}*.css';
}),
}
};
}
}
if (common.images) {
initConfig.imagemin = {
dist: {
files: _.map(common.images.options.dirs, function (value) {
return {
expand: true,
cwd: 'src/' + value,
src: '{,**/}*.{gif,jpeg,jpg,png}',
dest: 'dist/' + value,
};
}),
}
};
initConfig.svgmin = {
dist: {
files: _.map(common.images.options.dirs, function (value) {
return {
expand: true,
cwd: 'src/' + value,
src: '{,**/}*.svg',
dest: 'dist/' + value,
};
}),
}
};
initConfig.copy.img = {
files: [{
expand: true,
dot: true,
cwd: 'src',
dest: 'dist',
src: _.map(common.images.options.dirs, function (value) {
return value + '/{,**/}*.*';
}),
}]
};
if (common.useRev) {
initConfig.rev.img = {
files: {
src: _.map(common.images.options.dirs, function (value) {
return 'dist/' + value + '/{,**/}*.{gif,jpeg,jpg,png,webp}';
}),
}
};
}
}
buildList.push('useminPrepare'); // html
//buildList.push('usemin:views'
//buildList.push('requirejs'); // script
buildList.push('copy:css'); // css
//buildList.push('imagemin'); // image
//buildList.push('svgmin'); // image
//buildList.push('rev:img'); // image
if (common.images) {
buildList.push('imagemin'); // image
buildList.push('svgmin'); // image
if (common.useRev) {
buildList.push('rev:img'); // image
}
}
//buildList.push('autoprefixer'); // css
//buildList.push('concat:requirejs'); // montyPython
buildList.push('concat:generated'); // montyPython
......@@ -247,8 +305,8 @@ module.exports = function (grunt) {
buildList.push('copy:dist');
//'modernizr');
//buildList.push('uglify:generated'); // montyPython
//'rev:dist'); // montyPython
if (common.useRev) {
buildList.push('rev:dist'); // montyPython
buildList.push('rev:css'); // montyPython
}
//buildList.push('revconfig'); // montyPython
......
......@@ -23,7 +23,9 @@
"grunt-contrib-cssmin": "~0.12.3",
"grunt-contrib-jshint": "~0",
"grunt-contrib-htmlmin": "~0",
"grunt-contrib-imagemin": "~0",
"grunt-rev": "~0",
"grunt-svgmin": "~0",
"grunt-usemin": "~2",
"lodash": "~2",
"punch": "~0.5.46",
......