Detect release / debug in gulp using Visual Studio 2015

后端 未结 8 1354
自闭症患者
自闭症患者 2020-12-13 18:31

I\'ve set up an ASP.NET 5 project in Visual Studio and created a gulpfile.js which I use to build my typescript and less files.

For release builds, I want to uglify

8条回答
  •  别那么骄傲
    2020-12-13 18:37

    The easiest way I've found:

    1. Get your grunt/gulp tasks running using the Task Runner Explorer first by following this guide. Do not set any bindings though.

    grunt - https://docs.microsoft.com/en-us/aspnet/core/client-side/using-grunt

    gulp - https://docs.microsoft.com/en-us/aspnet/core/client-side/using-gulp

    1. Create Debug and Release grunt/gulp tasks.
    2. Once running with the Task Runner Explorer, copy the command that Visual Studio uses to run your task from the output window of Task Runner Explorer. (Ignore the bindings, do not set these)

    1. Change the paths so that they are relative to the bin folder, and to work with whichever mode is set in Visual Studio. From the image above, you would change the command to:

    cmd.exe /c gulp -b ".\.." --color --gulpfile ".\..\Gulpfile.js" $(ConfigurationName)

    1. Paste this command as a pre-build task in your project.

提交回复
热议问题