我对 scss mixin 中的编译 -ms-filter 属性有疑问。
mytheme.scss
@import "../reindeer/reindeer.scss";
@import "bg-alpha.scss";
@mixin mytheme {
@include reindeer;
.v-button {
@include bg-alpha(0.7);
-ms-filter:alpha(opacity=0.4); <---- OK
}
}
bg-alpha.scss
@mixin bg-alpha ($a) {
opacity:$a;
-ms-filter:alpha(opacity=$a*100); <---- ERROR
}
在编译期间抛出此错误
com.vaadin.sass.internal.parser.SCSSParseException: Error when parsing file C:\Develop...\VAADIN\themes\mytheme\bg-alpha.scss
Encountered "-ms-filter" at line 3, column 9.
Was expecting one of:
"}" ...
"+" ...
">" ...
"~" ...
"[" ...
"*" ...
"&" ...
"." ...
":" ...
<INTERPOLATION> ...
"@include" ...
"@debug" ...
"@warn" ...
"@each" ...
"@if" ...
"@extend" ...
"@content" ...
<IDENT> ...
<VARIABLE> ...
<HASH> ...
"@media" ...
"@page" ...
"@font-face" ...
<KEY_FRAME_SYM> ...
at com.vaadin.sass.internal.ScssStylesheet.get(ScssStylesheet.java:141)
at com.vaadin.sass.internal.visitor.ImportNodeHandler.traverse(ImportNodeHandler.java:69)
at com.vaadin.sass.internal.visitor.ImportNodeHandler.traverse(ImportNodeHandler.java:81)
at com.vaadin.sass.internal.ScssStylesheet.importOtherFiles(ScssStylesheet.java:192)
at com.vaadin.sass.internal.ScssStylesheet.compile(ScssStylesheet.java:185)
at com.vaadin.server.VaadinServlet.serveOnTheFlyCompiledScss(VaadinServlet.java:815)
at com.vaadin.server.VaadinServlet.serveStaticResourcesInVAADIN(VaadinServlet.java:601)
at com.vaadin.server.VaadinServlet.serveStaticResources(VaadinServlet.java:571)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:229)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
这个问题属于mixins,因为当我删除“-ms-filter:alpha(opacity=$a*100);” 来自 bg-alpha mixin,一切正常,没有抛出错误。
拜托,有人可以帮我解决这个问题吗?我用谷歌搜索了很多时间来寻找解决方案,但我没有成功。我也尝试用纯 sass 编译器模拟这个问题。这似乎是正确的 sass 代码。