【发布时间】:2014-11-29 21:00:00
【问题描述】:
在this post 我想我会学习 sbt 任务并自己创建。我已经到了一个阶段,我创建了一个在编译之前运行并编译我的 sass 的任务。
val sassCompile = TaskKey[ Unit ]( "sassCompile" )
sassCompile := {
SassCompiler.compile( baseDirectory.value )
}
watchSources <++= baseDirectory map { path => ((path / "app" / "assets" ) ** "*.scss").get }
compile <<= (compile in Compile) dependsOn sassCompile
我做两件事:
- 确保对 scss 的每次更改都会触发编译
- 编译前,sass 编译器运行
那么什么有效:
- 触发编译工作。每次我更改我的 scala 时,编译都会触发。 (通常的行为)。每次我在提到的路径中更改 .scss 时:app/assets/**,编译触发器。一切正常。
- 当我在 play 控制台手动输入 compile 时,sass 编译也会触发,我可以看到 css 文件发生变化。
什么不起作用:
当编译被自动触发时(通过调用 ~compile 或 ~run 然后进行更改(甚至不进行更改),sass 编译不会被调用。所以当我玩 ~run 时,我的 sass 编译器不会被调用。
编辑:如果有帮助,here 是一个类似的问题。
【问题讨论】:
标签: scala playframework playframework-2.0 sbt