开发者

Site.css to Debug mode, site-min.css to release mode

开发者 https://www.devze.com 2023-04-07 12:02 出处:网络
In my view like that in debug mode to view Site.css use her, and when compiled in release mode the view using CSS-min.css site.

In my view like that in debug mode to view Site.css use her, and when compiled in release mode the view using CSS-min.css site.

Something like this:

# if (Debug)
             / / CSS
# elif (R开发者_如何学Goelease)
             / / CSS Min-
# endif

But in my view .cshtml


You can use Context.IsDebuggingEnabled. This boolean property is controlled by the debug attribute from the compilation section in web.config.

Here's a sample for your view.cshtml :

if (Context.IsDebuggingEnabled)
{
    // use something.css
}
else
{
    // use something.min.css
}


asp.net mvc - Razor view engine, how to enter preprocessor(#if debug) - Stack Overflow

How about this?

0

精彩评论

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

关注公众号