Skip to content

Instantly share code, notes, and snippets.

@nubz
Forked from tanepiper/Gruntfile.js
Last active December 16, 2015 01:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nubz/5357005 to your computer and use it in GitHub Desktop.
Save nubz/5357005 to your computer and use it in GitHub Desktop.
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
aws: grunt.file.readJSON('config/grunt-aws.json'),
datetime: Date.now(),
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
eqnull: true,
browser: true,
globals: {
jQuery: true,
$: true,
console: true
}
},
'myproject': {
src: [ 'src/js/**/*.js' ]
}
},
concat: {
'myproject': {
src: [ 'src/js/file1.js', 'src/js/file2.js' ],
dest: 'build/fileoutput.js'
}
},
uglify: {
options: {
banner: grunt.file.read('LICENCE'),
mangle: {toplevel: true},
squeeze: {dead_code: false},
codegen: {quote_keys: true}
},
'myproject': {
src: 'build/fileoutput.js',
dest: 'build/fileoutput.min.js'
}
},
jasmine: {
'myproject': {
src : 'build/**/*.min.js',
options: {
specs : 'spec/**/*.spec.js'
}
}
},
cssmin: {
'myproject': {
files: {
'build/cssoutput.min.css': [ 'src/css/file1.css', 'src/css/file2.css' ]
}
}
},
s3: {
key: '<%= aws.key %>',
secret: '<%= aws.secret %>',
bucket: '<%= aws.bucket %>',
access: 'public-read',
upload: [{
src: 'build/fileoutput.min.js',
dest: 'website/javascript/fileoutput.<%= datetime %>.min.js',
gzip: false
},
{
src: 'build/cssoutput.min.css',
dest: 'website/css/cssoutput.min.<%= datetime %>.min.css',
gzip: false
}]
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-s3');
// Default task.
grunt.registerTask('default', ['jshint:myproject', 'concat:myproject', 'uglify:myproject', 'jasmine:myproject', 'cssmin:myproject']);
grunt.registerTask('upload', ['s3']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment