Dynamically setting variables with Grunt
Set API Keys based on the deployment environment. The problem During the development of a web project, probably you will be using test API keys and other 'sensitive' information that you will need to remember to replace before every commit / deployment. For tasks like this that can lead to big headache, it seems like a great opportunity to automate . Either as part of CI or even as part of your daily routines. Description The idea is your environment to hold the sensitive information (environment variable). When the grunt task runs, picks up the variable value, and defines a local (in the task) variable. Then another task is searching in your files for the 'placeholder', and replaces the string with the actual variable. The output file that is generated (including the sensitive information), goes to a folder that is public to your server. Furthermore, the destination folder (dist) is included in .gitignore to avoid pushing to the repo. Step by step L