Skip to content

Instantly share code, notes, and snippets.

@gurre
Created February 20, 2015 12:03
Show Gist options
  • Save gurre/0c2f125fd919079c24b3 to your computer and use it in GitHub Desktop.
Save gurre/0c2f125fd919079c24b3 to your computer and use it in GitHub Desktop.
Grunt task to develop, watch, and upload to S3 using awscli
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
files: ['public/**'],
tasks: ['deploy']
},
concat: {
options: {
separator: grunt.util.linefeed + ';' + grunt.util.linefeed,
},
dist: {
src: [
'public/assets/js/vendor/jquery*.js',
'public/assets/js/vendor/**.js'
],
dest: 'public/assets/js/vendor.js'
}
},
exec: {
sass: 'sass scss/style.scss:public/assets/css/main.min.css --style compressed',
upload: 'aws s3 sync public s3://bucket --delete --acl public-read --cache-control "public, max-age=86400" --exclude "*/.DS_Store"',
website: 'aws s3 website s3://bucket --index-document index.html --error-document error.html',
cleanup: 'aws s3 rm s3://bucket --recursive --exclude "*" --include "*/.DS_Store"',
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('deploy', ['concat', 'exec']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment