更新时间:2023-01-02 21:33:17
具体来说,就像这样在C#中:
#if(DEBUG)
调试东西
#endif
C#具有以下预处理指令:
#if
#else
#elif //否如果
#endif
#define
#undef // Undefine
#warning / /导致预处理器触发警告
#error //导致预处理器触发致命错误
#line //让预处理程序知道这个源代码行来自
#region // Codefolding
#endregion
So I have about 10 short css files that I use with mvc app. There are like error.css login.css etc... Just some really short css files that make updating and editing easy (At least for me). What I want is something that will optimize the if else branch and not incorporate it within the final bits. I want to do something like this
if(Debug.Mode){
<link rel="stylesheet" type="text/css" href="error.css" />
<link rel="stylesheet" type="text/css" href="login.css" />
<link rel="stylesheet" type="text/css" href="menu.css" />
<link rel="stylesheet" type="text/css" href="page.css" />
} else {
<link rel="stylesheet" type="text/css" href="site.css" />
}
I'll have a msbuild task that will combine all the css files, minimize them and all that good stuff. I just need to know if there is a way to remove the if else branch in the final bits.
Specifically, like this in C#:
#if (DEBUG)
Debug Stuff
#endif
C# has the following preprocessor directives:
#if
#else
#elif // Else If
#endif
#define
#undef // Undefine
#warning // Causes the preprocessor to fire warning
#error // Causes the preprocessor to fire a fatal error
#line // Lets the preprocessor know where this source line came from
#region // Codefolding
#endregion