简体   繁体   English

用于发布版本VS2010的不同Javascript和CSS

[英]Different Javascript and CSS for Release build VS2010

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? 我想让发布版本使用css / javascript'A'的缩小版本,而调试版本使用css / javascript'A'的未压缩版本,有什么办法可以在ASP.Net页面上执行? 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 . 我在有关在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. 要回答您的特定问题,您可以测试IsDebuggingEnabled标志来确定您是处于调试还是释放模式,并相应地发出不同的脚本引用。 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>
<% } %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM