Skip to content

Instantly share code, notes, and snippets.

@rotespferd
Created November 24, 2012 15:56
Show Gist options
  • Save rotespferd/4140256 to your computer and use it in GitHub Desktop.
Save rotespferd/4140256 to your computer and use it in GitHub Desktop.
A basic template gruntconfig file for grunt.js
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
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 %>;' +
' Licensed with <%= pkg.license %> license */'
},
lint: {
files: ['grunt.js', 'lib/**/*.js', 'test/**/*.js', 'yourjsfile.js']
},
qunit: {
files: ['test/**/*.html']
},
concat: {
dist: {
src: ['<banner:meta.banner>', 'yourjsfile.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
min: {
dist: {
src: ['<banner:meta.banner>', '<config:concat.dist.dest>'],
dest: 'dist/<%= pkg.name %>.min.js'
}
},
watch: {
files: '<config:lint.files>',
tasks: 'lint qunit'
},
jshint: {
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: true
}
},
uglify: {},
copy: {
dist: {
files: {
"dist/": "*.html",
"dist/": "*.css"
}
}
}
});
// Import Plugins
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task.
grunt.registerTask('default', 'lint qunit concat min');
grunt.registerTask('dev', 'lint qunit');
grunt.registerTask('deploy', 'lint qunit concat min copy');
grunt.registerTask('dev-nolint', "concat min copy");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment