I have this env task:
env: {
dev: {
NODE_ENV: 'dev',
DEST: '<%= config.dev %>'
},
dist: {
NODE_ENV: 'dist',
DEST: '<%= config.dist %>'
}
},
Along with a simply task to test that process.env.DEST is getting set correctly.
grunt.registerTask('testEnv', function(){
console.log(process.env.DEST);
});
When I run it I get the expected output of dev.
Running "env:dev" (env) task
Running "testEnv" task
dev
Done, without errors.
Now if I use process.env.DEST inside another grunt task I get the value as undefined.
Running tasks: env:dev, testEnv, concat:preload
Running "env:dev" (env) task
Verifying property env.dev exists in config...OK
File: [no files]
Options: (none)
Running "testEnv" task
dev
Running "concat:preload" (concat) task
Verifying property concat.preload exists in config...OK
Files: app/scripts/preload/modernizr.js -> undefined/scripts/preload.js
Options: separator="\n", banner="", footer="", stripBanners=false, process=false, sourceMap=false, sourceMapName=undefined, sourceMapStyle="embed"
Reading app/scripts/preload/modernizr.js...OK
Writing undefined/scripts/preload.js...OK
File undefined/scripts/preload.js created.
Done, without errors.
You can see the undefined in this line Files: app/scripts/preload/modernizr.js -> undefined/scripts/preload.js. It's a simple concat task where I want the output to be different dependent on the environment I set.
concat: {
baseDir: '<%= config.app %>/scripts',
preload: {
src: ['<%= concat.baseDir %>/preload/*.js'],
dest: process.env.DEST + '/scripts/preload.js'
},
libs: {
src: ['<%= concat.baseDir %>/libs/*.js'],
dest: process.env.DEST + '/scripts/vendors.js'
}
},
I've been at this for a day now and have no clue what I'm doing wrong. Any help would be greatly appreciated.
I have this
envtask:Along with a simply task to test that
process.env.DESTis getting set correctly.When I run it I get the expected output of
dev.Now if I use
process.env.DESTinside another grunt task I get the value asundefined.You can see the undefined in this line
Files: app/scripts/preload/modernizr.js -> undefined/scripts/preload.js. It's a simple concat task where I want the output to be different dependent on the environment I set.I've been at this for a day now and have no clue what I'm doing wrong. Any help would be greatly appreciated.