Skip to content

Instantly share code, notes, and snippets.

@gergelyke
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergelyke/9070770 to your computer and use it in GitHub Desktop.
Save gergelyke/9070770 to your computer and use it in GitHub Desktop.
{
"accessKeyId": "akid",
"secretAccessKey": "secret",
"region": "us-east-1"
}
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
concat: {
dist: {
src: ['main.js', 'ctrl1.js'], //source files goes here
dest: 'build/lib.js' //concatenated file goes here
}
},
uglify: {
options: {
compress: {
dead_code: true
},
wrap: true,
sourceMap: true
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'build/lib.min.js',
}
},
s3: {
options: {
region: 'us-east-1',
endpoint: 's3.amazonaws.com',
access: 'public-read',
headers: { 'Cache-Control': 'max-age=60' },
gzip: true,
bucket: 'bucketname'
},
upload: [
{
src: 'path/to/builtlib.js',
dest: 'path/in/s3/lib.js'
}
]
},
cloudfront:
options: {
credentials: grunt.file.readJSON('credentials.json'),
region: 'us-east-1',
distributionId: "YOUR_DISTRIBUTION_ID",
listInvalidations: true
},
paths: [
'url/of/cloudfront/lib.js'
]
},
hipchat_notifier: {
options: {
authToken: "", // your authtoken
roomId: "" // Numeric Hipchat roomId
},
deployed: {
message: 'Wow, deployed!',
from: 'Wizard of Grunt',
color: 'red'
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-cloudfront');
grunt.loadNpmTasks('grunt-hipchat-notifier');
//also, you could combine these steps, and have a task like:
//grunt.registerTask('deploy', ['concat', 'uglify', 's3', 'cloudfront', 'hipchat_notifier']);
grunt.registerTask('build', ['concat', 'uglify']);
grunt.registerTask('deploy', ['s3', 'cloudfront', 'hipchat_notifier']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment