开发者

Different Javascript and CSS for Release build VS2010

开发者 https://www.devze.com 2023-01-20 05:19 出处:网络
I would like to have my release build use the minified version of css/javascript \'A\' and the debug build u开发者_运维技巧se my uncompressed version of css/javascript \'A\' is there any way I can do

I would like to have my release build use the minified version of css/javascript 'A' and the debug build u开发者_运维技巧se 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.


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>
<% } %>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号