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. .
Is there any variable which is accessible from the gruntfile?
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With