VS MVC 项目 CSS 使用 CSS 变量时缩小失败
VS MVC Project CSS Minification fails when using CSS variables
在 Visual Studio 中,当我在捆绑的 css 文件中引入任何变量时,我在 MVC 项目中的缩小失败。示例:
/* Minification failed. Returning unminified contents.
(3,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,23): run-time error CSS1039: Token not allowed after unary operator: '-main-bg-color'
*/
:root {
/*DEFAULT COLORS LINES*/
--main-bg-color: rgb(34,34,34);
}
body{
background-color:var(--main-bg-color);
}
其他压缩器工作正常,有没有办法解决这个问题?
visual studio 中用于放大 CSS 的 BundlerMinifier 库目前无法处理 CSS 个变量。
此问题已在 github https://github.com/madskristensen/BundlerMinifier/issues/218 / https://github.com/xoofx/NUglify/issues/17 上提出。
希望对您有所帮助。
我最终实现了 Sass 作为双重解决方案,它允许使用多种可变方法和缩小。
在 Visual Studio 中,当我在捆绑的 css 文件中引入任何变量时,我在 MVC 项目中的缩小失败。示例:
/* Minification failed. Returning unminified contents.
(3,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '-'
(6,23): run-time error CSS1039: Token not allowed after unary operator: '-main-bg-color'
*/
:root {
/*DEFAULT COLORS LINES*/
--main-bg-color: rgb(34,34,34);
}
body{
background-color:var(--main-bg-color);
}
其他压缩器工作正常,有没有办法解决这个问题?
visual studio 中用于放大 CSS 的 BundlerMinifier 库目前无法处理 CSS 个变量。
此问题已在 github https://github.com/madskristensen/BundlerMinifier/issues/218 / https://github.com/xoofx/NUglify/issues/17 上提出。
希望对您有所帮助。
我最终实现了 Sass 作为双重解决方案,它允许使用多种可变方法和缩小。