Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I've wrote a task to minify my .js files.

Now, I want to conditionally uglify them (do it if in release, don't if in debug), based on the configuration mode of VS15, e.g. enter image description here.

Is there any variable which is accessible from the gruntfile?

like image 331
user265732 Avatar asked Aug 17 '15 07:08

user265732


1 Answers

set NODE_ENV=$(ConfigurationName)
gulp

This row will let you read which build symbol is used in Visual Studio when compiling your solution. To access this variable you can use process.env.NODE_ENV. So we can use this piece of code to check if we are compiling in Debug or Release mode and then decide if we should run the minifying 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/

like image 197
Artyom Slobolinsky Avatar answered Nov 13 '22 05:11

Artyom Slobolinsky