3

我正在使用 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。

4

1 回答 1

3

谢谢亚历克斯,

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

preProcessors=less4j, yuiCssMin,googleClosureSimple
#postProcessors=less4j

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

于 2014-02-23T11:00:41.903 回答