A simple plugin to trigger a cloudfront invalidation
This plugin requires Grunt >=1.0.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-cloudfront-invalidate --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-cloudfront-invalidate');
In your project's Gruntfile, add a section named cloudfront_invalidate
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
cloudfront_invalidate: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
Type: String
Your aws cloudfront access key. Required.
Type: String
Your aws cloudfront secret key. Required.
Type: String
Your aws cloudfront distribution id. Required.
Type: Boolean
If true
, the plugin will dump the generated invalidation options that will be sent to amazon
Type: String|Array
The path(s) to add to the invalidation batch. Can set to /* to invalidate all files in the dist.
Type: Object
The grunt files config for the files you would like to invalidate.
{
config: {
options: {
accessKeyId: <YOUR_ACCESS_KEY>,
secretAccessKey: <YOUR_SECRET_KEY>,
distributionId: <YOUR_DISTRIBUTION_ID>,
path: '/*'
},
}
}
{
config: {
options: {
accessKeyId: <YOUR_ACCESS_KEY>,
secretAccessKey: <YOUR_SECRET_KEY>,
distributionId: <YOUR_DISTRIBUTION_ID>,
},
files: {
expand: true,
src: ['**/*.js'],
dest: '/'
}
}
}
Feel free to report bugs, suggest features and submit pull requests on GitHub!
v 2.0.0 - Update dependencies, config and author info
v 1.0.0 - Initial Commit