Home:ALL Converter>In AngularJS how do I substitute minified javascript files with non-minified files in my development environment?

In AngularJS how do I substitute minified javascript files with non-minified files in my development environment?

Ask Time:2015-08-04T04:36:37         Author:Jamie Lara

Json Formatter

What is the best way to handle this in AngularJS?

I have an AngularJS app that includes concatenated/minified javascript files, however in my development environment I want to load the non-concatented/non-minified versions of the file. I want this because it is easier to debug the code with non-minified files.

<!-- production -->
<script src="js/all.min.js"></script> <!-- contains all concatenated/minified code -->

<!-- dev -->
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives.js"></script>

I am not sure how to do this since in AngularJS I couldn't find a conditional mechanism that is suitable. I had thought about using a directive on the each script tag?

I am using Gulp to concat and uglify the files, but I couldn't find a method to accomplish this with Gulp.

PHP is the server-side language.

Any help will be greatly appreciated.

Author:Jamie Lara,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/31796326/in-angularjs-how-do-i-substitute-minified-javascript-files-with-non-minified-fil
gusjap :

You could create a \"Source Map\" to go along with the minified javascript file. The source map can then be used when debugging so you can see the original code. If you are using for example UglifyJS 2.0 or Closure Compiler there is an option of creating a source map when you create the minified javascript.\n\nFore more information about source maps and debugging: source maps debugging in Google Chrome ",
2015-08-03T20:48:26
yy