Last active
December 15, 2015 18:49
-
-
Save alliejones/5306809 to your computer and use it in GitHub Desktop.
Gruntfile template. Includes lint, concat, uglify and watch as well as growl notifications of errors and warnings (requires npm growl package to be installed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
var defaultTasks = ['jshint', 'concat', 'uglify']; // used for watch as well | |
var files = [ /* your source files */ ]; | |
grunt.initConfig({ | |
jshint: { | |
all: files.concat(['Gruntfile.js']) | |
}, | |
concat: { | |
all: { | |
src: files, | |
dest: 'project.all.js', | |
} | |
}, | |
uglify: { | |
all: { | |
files: { | |
'project.min.js': files | |
} | |
} | |
}, | |
watch: { | |
all: { | |
files: files, | |
tasks: defaultTasks, | |
options: { | |
debounceDelay: 250 | |
} | |
} | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.registerTask('default', defaultTasks); | |
var growl = require('growl'); | |
['warn', 'fatal'].forEach(function(level) { | |
grunt.util.hooker.hook(grunt.fail, level, function(opt) { | |
growl(opt.name, { | |
title: opt.message, | |
image: 'Console' | |
}); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment