我正在尝试设置gradle,以便运行两次compass任务来编译两组CSS文件。
我在我的gradle文件中有以下部分来实现这一点:
buildscript {
dependencies {
classpath "com.github.robfletcher:compass-gradle-plugin:2.0.5"
}
apply plugin: "com.github.robfletcher.compass"
compass {
debugInfo = true
time = true
sourcemap = true
}
task compassWeb(type: com.github.robfletcher.compass.CompassTask) {
cssDir = file("src/main/webapp/web/css")
sassDir = file("src/main/sass/web")
}
task compassMobile(type: com.github.robfletcher.compass.CompassTask) {
cssDir = file("src/main/webapp/mobile/css")
sassDir = sassDir = file("src/main/sass/mobile")
}
processResources.dependsOn("compassMobile", "compassWeb")
每次我运行这个,我都会得到相同的错误:
Execution failed for task ':compassMobile'.
> Illegal null value provided in this collection: [-S, compass, null, -- sourcemap, --time, --debug-info, --sass-dir, /Users/.../src/main/sass/mobile, --css-dir, /Users/.../src/main/webapp/mobile/css]
错误似乎是"compass"脚本参数后的null。
这似乎是CompassTask或JRubyExecTask的问题。我试着遵循每个插件中的代码,但我无法计算出我的配置中缺少了什么。
或者,有没有更好的方法来完成两次评分任务?
您必须指定要执行的任务类型。
如果您查看CompassTask内部,会发现一个参数:String command
因此,将此添加到您的conf:
task compassWeb(type: com.github.robfletcher.compass.CompassTask) {
command = "compile"
cssDir = file("src/main/webapp/web/css")
sassDir = file("src/main/sass/web")
}