Reputation: 1679
I am trying to compile *.less resources from my assets/stylesheets/
directory. I have one file contained in this directory, which is masterpage.less
.
I have added the sbt plugin for less
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
in my plugins.sbt
file.
The Play documentation says:
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.
Which I am doing, so I am confused as to why my resources are not being compiled into public/
Here are the routes I have:
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)
This is how I am trying to link the css page in my html file:
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/masterpage.css")"/>
and lastly, here is the error I am getting in my console:
GET http://localhost:9000/assets/masterpage.css
Upvotes: 4
Views: 736
Reputation: 11274
By default, sbt-less only looks for a file called main.less
. If you want to use a different file, you have to indicate it in build.sbt.
includeFilter in (Assets, LessKeys.less) := "masterpage.less"
If you want to include all LESS files, use a wildcard:
includeFilter in (Assets, LessKeys.less) := "*.less"
This is not the default because you normally import LESS files from your main.less
.
Upvotes: 6