Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created July 26, 2012 20:42
Show Gist options
  • Save cowboy/3184383 to your computer and use it in GitHub Desktop.
Save cowboy/3184383 to your computer and use it in GitHub Desktop.
grunt: sample gruntfile for jquery init template w/ all jshint options/globals
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:awesome.jquery.json>',
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
concat: {
dist: {
src: ['<file_strip_banner:src/<%= pkg.name %>.js>'],
dest: 'dist/<%= pkg.name %>.js'
}
},
min: {
dist: {
src: '<config:concat.dist.dest>',
dest: 'dist/<%= pkg.name %>.min.js'
}
},
qunit: {
files: ['test/**/*.html']
},
lint: {
options: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
browser: true,
},
globals: {
jQuery: false,
}
},
gruntfile: {
src: 'Gruntfile.js',
options: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true,
es5: true,
}
}
},
src: ['src/**/*.js'],
test: {
src: ['test/**/*.js'],
options: {
globals: {
jQuery: false,
QUnit: false,
module: false,
test: false,
asyncTest: false,
expect: false,
start: false,
stop: false,
ok: false,
equal: false,
notEqual: false,
deepEqual: false,
notDeepEqual: false,
strictEqual: false,
notStrictEqual: false,
raises: false,
}
}
},
},
watch: {
files: '<config:lint.files>',
tasks: ['lint', 'qunit']
}
});
// Default task.
grunt.registerTask('default', ['lint', 'qunit', 'concat', 'min']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment