I have some code in a grunt.js file which is working with 0.3 but breaks on 0.4:
{ dest: '<%= process.env.DEST %>/index.html' }
In 0.3 process is defined and so I can access variables defined in the environment inside the template when I am e.g. passing file paths to other plugins.
Is there an alternative approach to this which will work in 0.4? Or a way to put a breakpoint in while the template is rendering so that I can see what variables are available?
Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file (known as a Gruntfile). Grunt was created by Ben Alman and is written in Node.
The default data is the config object. You can add the environment variable to the config object or just use it directly.
grunt.initConfig({ destination: process.env.DEST, task: { target: { dest: '<%= destination %>/index.html' } }, });
or
grunt.initConfig({ task: { target: { dest: process.env.DEST + '/index.html' } }, });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With