I am trying to minify a little angular script, but for some reason uglify just hangs indefinitely. JSHint runs fine and completes if I add it into the task list, and then it hangs on uglify.
Here is my Gruntfile:
module.exports = function (grunt) {
// Project configuration
grunt.initConfig({
// make node configuration available for use
pkg: grunt.file.readJSON('package.json'),
// configure uglify
uglify: {
options: {
mangle: false
},
my_target: {
dist: {'dist/test.min.js': ['src/test.js']}
}
},
// configure JSHint
jshint: {
app: ['src/*.js']
}
});
// load pluginsng
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
// default
grunt.registerTask('default', ['jshint', 'uglify']);
grunt.registerTask('uglify', ['uglify']);
};
Here are the versions I am using:
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-uglify": "~0.9.1"
}
I ran grunt -v
and after jshint finishes it outputs this forever:
Running "uglify" task
Running "uglify" task
Running "uglify" task
It doesn't seem to care what file I give it either, so it seems to be hitting some issue before it gets to reading my file.
Any ideas?
You're redefining the uglify task to run itself in your last line, replacing grunt-contrib-uglify:
grunt.registerTask('uglify', ['uglify']);
That's why your grunt is looping endlessly. Just give it a different name:
grunt.registerTask('compress', ['uglify']);