How to get the current configuration (Debug / Release) of VS15 in gulpfile.js?

I wrote a task to minimize my .js files.

Now I want to conditionally guess them (do this if in the release, not in debugging) based on the VS15 configuration mode, for example. enter image description here .

Is there any variable available from the grunt file?

+5
source share
1 answer
set NODE_ENV=$(ConfigurationName) gulp 

This line will let you read which assembly symbol is used in Visual Studio when compiling your solution. To access this variable, you can use process.env.NODE_ENV. Thus, we can use this piece of code to check whether we are compiling in debug or release mode, and then decide whether to run the mini-task or not.

 var tasksToRun = ['scripts']; if(process.env.NODE_ENV === 'Release'){    tasksToRun.push('minify'); } gulp.task('default', tasksToRun); 

http://www.myeyeson.net/gulp-js-and-browserify-with-asp-net/

+3
source

All Articles