Encrypt your files with Grunt
This plugin requires Grunt
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-encrypt --save-dev
The "encrypt" task
In your project's Gruntfile, add a section named
encrypt to the data object passed into
A string value used to encrypt a file
A string to the output directory, defaults to the source file path
A string to set the file extension for the encrypted file.
An object containing a map of files. See below for examples.
In this example we are encrypting some configuration files and outputing to the same directory. You can set the output directory by passing the
dest option, you can assign the encryption key by passing the
key option. By passing the
ext option the input files become
In this example we are decrypting some configuration files, we are providing the key through environment variables. You can decrypt files by passing the
decrypt option to the task, If the
dest option is a directory it will generate the new file with the existing name.
The decrypt option removes the last extension in the filename, for example if you encrypt a file with the filename as
passwords.json and you don't provide the
.json will be removed.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
- 2014-08-06 v0.1.0 Initial release