2010-10-13 57 views
0

我想我的發佈版本使用縮小版本的CSS/JavaScript'A'和調試版本使用我的未壓縮版本的CSS/JavaScript'A'有沒有什麼辦法可以在ASP.Net頁面上做到這一點?基本上我很懶,不想在每次發佈時都必須更改引用。不同的Javascript和CSS版本構建VS2010

在此先感謝。

回答

1

我在我的文章中介紹了關於automating the combine/minify process in Visual Studio

要回答您的具體問題,可以測試IsDebuggingEnabled標誌以確定您處於調試模式還是發佈模式,並相應地發出不同的腳本引用。例如,這是從文章的例子:

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

真棒謝謝一堆 – Adrian 2010-10-13 17:06:39