我想,当我建立由Visual Studio解决方案,通过内容咕噜替换注入。不过,我想这取决于构建配置不同的内容注入。
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 possible to read the build configuration using grunt/node.
感谢。
推荐答案
您可以使用 grunt.option
这一点。提供在命令行上构建ENV和使用grunt.option把它用在Gruntfile。
You can use grunt.option
for this. Provide your build env on the command line and use it in the Gruntfile using grunt.option.
引述的例子grunt.option 文档
Quoting the example from grunt.option documentation
Gruntfile.js
Gruntfile.js
grunt.initConfig({
compass: {
dev: {
options: {
/* ... */
outputStyle: 'expanded'
},
},
staging: {
options: {
/* ... */
outputStyle: 'compressed'
},
},
},
});
var target = grunt.option('target') || 'dev';
grunt.registerTask('deploy', ['compass:' + target]);
当您运行繁重的部署样式表将默认为开发目标和输出的CSS的扩展格式。如果您运行咕噜部署--target =分期
的分期目标将改为跑了,你的CSS是在COM pressed格式。
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
相关推荐
最新文章