Injecting Content Via Grunt Task, Depending On Asp.net Project Build Configuration
I'm trying to inject content via grunt-replace when I build by visual studio solution. However I would like to inject different content depending on the build configuration. Is it
Solution 1:
You can use grunt.option
for this. Provide your build env on the command line and use it in the Gruntfile using grunt.option.
Quoting the example from grunt.option documentation
Gruntfile.js
grunt.initConfig({
compass: {
dev: {
options: {
/* ... */
outputStyle: 'expanded'
},
},
staging: {
options: {
/* ... */
outputStyle: 'compressed'
},
},
},
});
var target = grunt.option('target') || 'dev';
grunt.registerTask('deploy', ['compass:' + target]);
As you run grunt deploy your stylesheets would default to the dev target and output the CSS in the expanded format. If you ran grunt deploy --target=staging
the staging target would instead be ran and your CSS would be in the compressed format.
grunt deploy --target=staging
Post a Comment for "Injecting Content Via Grunt Task, Depending On Asp.net Project Build Configuration"