wro4j less-compiler 也编译 .css 文件

标签 wro4j

我正在使用 wro4j 1.7.3 和 less4j/le​​ssCSS 编译器。

preProcessors=less4j,
yuiCssMin,googleClosureSimple

在我的 wro.xml 中,我有类似的东西:

<group name='css'>
    <css>/resources/css/base.css</css>
</group>

编译时,我会得到一个错误,因为 wro4j 将我的 *.css 文件也视为 *.less 文件。

Exception occured while processing: ro.isdc.wro.WroRuntimeException: 
Could not compile    less. 1 error(s) occured:
ERROR 437:1 missing EOF at '}' in stylesheet (which started at 23:1)
, class: ro.isdc.wro.WroRuntimeException,caused by:     
com.github.sommeri.less4j.Less4jException Could not compile less. 1 error(s) occured:
ERROR 437:1 missing EOF at '}' in stylesheet (which started at 23:1)

当使用 lessCSS 而不是 less4j 时,错误原因会更好地显示:

MEZ: [ERROR] Exception occured while processing: ro.isdc.wro.WroRuntimeException: Could  
not execute the script because: 
{
"type": "Runtime",
"message": "error evaluating function `saturate`: Cannot find function toHSL in object   
[object Object].",
"filename": null,
"index": 11114.0,
"line": 754.0,
"callLine": null,
"callExtract": null,
"stack": null, 
"column": 17.0,
"extract": [
".img-saturate{ ",
"   -webkit-filter: saturate(500%);",
"   -moz-filter: saturate(500%);"
]
}, class: ro.isdc.wro.WroRuntimeException,caused by:  Could not execute the script   
because: 
{
"type": "Runtime",
"message": "error evaluating function `saturate`: Cannot find function toHSL in   
object [object Object].",
"filename": null,
"index": 11114.0,
"line": 754.0,
"callLine": null,
"callExtract": null,
"stack": null,
"column": 17.0,
"extract": [
".img-saturate{ ",
"   -webkit-filter: saturate(500%);",
"   -moz-filter: saturate(500%);"
] 
}

更改处理器顺序没有帮助:

preProcessors=yuiCssMin,googleClosureSimple
postProcessors=less4j

错误仍然存​​在。

有没有可能,比如 wro4j,它不应该将以 css 结尾的文件视为 less。

最佳答案

谢谢亚历克斯,

通过使用 less4j.less,less-processor 将只扫描 less-files:

preProcessors=less4j, yuiCssMin,googleClosureSimple
#postProcessors=less4j

然而,后来我找到了错误的真正原因。 css 文件中缺少结束大括号。通过添加大括号,一切正常!

关于wro4j less-compiler 也编译 .css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21953836/

相关文章:

java - Wro4j、webjars 和 font-awesome

css - Wro4j:从 LESS 文件生成 CSS 文件

maven - wro4j-maven-plugin 性能缓慢

maven - 带有 wro4j 和 Google Closure Compiler 的 ECMASCRIPT 5

java - Spring MVC 4 targetBeanName NoSuchBeanDefinitionException

maven - bootstrap 3.1.0 的 wro4j less 处理失败

java - 为什么 YUIJsCompressorProcessor 类不包含在 wro4j 的核心或扩展 jar 中?

spring - wro4j - 使用运行时解决方案构建所有组

java - 仅对特定的一组文件使用 LessCssProcessor