How to Determine the ASP.NET Core Environment in my Gulpfile.js

前端 未结 2 969
执笔经年
执笔经年 2021-01-11 16:15

I am using ASP.NET Core MVC 6 using Visual Studio 2015. In my gulpfile.js script I want to know if the hosting environment is Development, Staging or Production so that I ca

2条回答
  •  隐瞒了意图╮
    2021-01-11 16:46

    You would need to set the NODE_ENV environment variable in each environment and then in your gulpfile, read it in using process.env.NODE_ENV.

    Have a look at https://stackoverflow.com/a/16979503/672859 for additional details.

提交回复
热议问题