更少的资源不编译 Play 2.3.7

Less Resources not Compiling Play 2.3.7

我正在尝试从我的 assets/stylesheets/ 目录编译 *.less 资源。我在该目录中包含一个文件,即 masterpage.less

我已经添加了 less 的 sbt 插件 addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6") 在我的 plugins.sbt 文件中。

Play documentation 说:

Compilable assets in Play must be defined in the app/assets directory. They are handled by the build process, and LESS sources are compiled into standard CSS files. The generated CSS files are distributed as standard resources into the same public/ folder as the unmanaged assets, meaning that there is no difference in the way you use them once compiled.

我在做什么,所以我很困惑为什么我的资源没有被编译成 public/

这是我的路线:

GET    /assets/*file    controllers.Assets.at(path="/public", file)
GET    /vassets/*file   controllers.Assets.versioned(path="/public", file: Asset)
GET    /webjars/*file   controllers.WebJarAssets.at(file)

这就是我尝试 link 我的 html 文件中的 css 页面的方式:

<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/masterpage.css")"/>

最后,这是我在控制台中遇到的错误:

 GET http://localhost:9000/assets/masterpage.css 

默认情况下,sbt-less 只查找名为 main.less 的文件。如果您想使用不同的文件,您必须在 build.sbt.

中注明
includeFilter in (Assets, LessKeys.less) := "masterpage.less"

如果要包含所有 LESS 文件,请使用通配符:

includeFilter in (Assets, LessKeys.less) := "*.less"

这不是默认设置,因为您通常从 main.less.

导入 LESS 文件