views:

24

answers:

1

I would like to have my release build use the minified version of css/javascript 'A' and the debug build use my uncompressed version of css/javascript 'A' is there any way I can do that on and ASP.Net page? Essentially I am lazy and don't want to have to change references everytime I do a publish.

Thanks in advance.

A: 

I cover that in my article about automating the combine/minify process in Visual Studio.

To answer your specific question, you can test the IsDebuggingEnabled flag to determine whether you're in debug or release mode and emit different script references accordingly. For example, this is from the article's example:

<% if (HttpContext.Current.IsDebuggingEnabled) { %>
  <script type="text/javascript" src="js/01-jquery-1.3.2.debug.js"></script>
  <script type="text/javascript" src="js/05-jquery-jtemplates.debug.js"></script>
  <script type="text/javascript" src="js/10-default.debug.js"></script>
<% } else { %>
  <script type="text/javascript" src="js/js-bundle.min.js"></script>
<% } %>
Dave Ward
Awesome thanks a bunch
antonlavey