Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
run this with one of these options:
"grunt" alone creates a new, completed images directory
"grunt clean" removes the images directory
"grunt responsive_images" re-processes images without removing the old ones
module.exports = function(grunt) {
responsive_images: {
dev: {
options: {
sizes: [
{width:1600, suffix: '_large_1x', quality:60},
{width:800, suffix: '_medium_1x', quality:70},
{width:550, suffix: '_small_1x', quality:100}
You don't need to change this part if you don't change
the directory structure.
files: [{
expand: true,
src: ['*.{gif,jpg,png}'],
cwd: 'img',
dest: 'images/'
/* Clear out the images directory if it exists */
clean: {
dev: {
src: ['images'],
/* Generate the images directory if it is missing */
mkdir: {
dev: {
options: {
create: ['images']
/* Copy any images we don't want to resize */
copy: {dev: {files: [{expand: true, src: 'imgs/fixed/*.{gif,jpg,png}', dest: 'images/'}]},},});
grunt.registerTask('default', ['clean','responsive_images']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.