John
John

Reputation: 123

SyntaxError: Unexpected token ) in Gruntfile

I am getting an error when trying to run my Gruntfile to resize images. I followed the tutorial but am not sure how to add my additional task. The error is

SyntaxError: Unexpected token ) in Gruntfile

The line is :

});

From what I can tell it looks as though that ) is needed.

// Project configuration.
grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),
  uglify: {
    options: {
      banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
    },
    build: {
      src: 'src/<%= pkg.name %>.js',
      dest: 'build/<%= pkg.name %>.min.js'
    }
  },
  resize_crop: {
    image_group: {
      options: {
        format: "jpg",
        gravity: "center",
        height: 30,
        width: 30
      },
      files: {
        '/Users/john/changeimages/30x30': [
          '/Users/john/changeimages/stopsign.jpeg'
        ],
      },
    }
 }
});

grunt.loadNpmTasks('grunt-resize-crop');

Upvotes: 2

Views: 914

Answers (1)

Seth Flowers
Seth Flowers

Reputation: 9210

Try getting rid of the two extra commas after the end of the array in the files object, and after the files object itself:

Change this:

files: {
  '/Users/john/changeimages/30x30': [
    '/Users/john/changeimages/stopsign.jpeg'
  ],
},

To this:

files: {
  '/Users/john/changeimages/30x30': [
    '/Users/john/changeimages/stopsign.jpeg'
  ]
}

Upvotes: 2

Related Questions