I am running into a weird issue with grunt-ng-constant
where only 2 out of 3 of the targets work.
My configuration looks like the following:
grunt.initConfig({
ngconstant: {
options: {
space: ' ',
wrap: '"use strict";\n\n {%= __ngModule %}',
name: 'config'
},
// Environment targets
development: {
options: {
dest: '<%= yeoman.app %>/scripts/config.js',
},
constants: {
ENV: {
name: 'development',
apiEndpoint: 'http://your-development.api.endpoint:3000'
}
}
},
staging: {
options: {
dest: '<%= yeoman.app %>/scripts/config.js',
},
constants: {
ENV: {
name: 'staging',
apiEndpoint: 'http://your-staging.api.endpoint:3000'
}
}
},
production: {
options: {
dest: '<%= yeoman.dist %>/scripts/config.js',
},
constants: {
ENV: {
name: 'production',
apiEndpoint: 'http://api.livesite.com'
}
}
}
}
})
and I have the following tasks being registered
grunt.registerTask('development', [
'ngconstant:development'
]);
grunt.registerTask('staging', [
'ngconstant:staging'
]);
grunt.registerTask('production', [
'ngconstant:production'
]);
If I run the two following commands, everything works fine and the config.js
file is generated and looks great.
grunt development
grunt staging
but running grunt production
doesn't generate the config.js
file. I can't seem to figure out why this is happening.
I both developmend and staging tasks you are generating config.js
file in a path beginning with <%= yeoman.app %>
, but in production you are using one that starts with <%= yeoman.dist %>
.
I would check if the second path (or yeoman.dist
) exists.
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