Less resources, not compilation Play 2.3.7

I am trying to compile * .less resources from my directory assets/stylesheets/. I have one file contained in this directory, which masterpage.less.

I added the sbt plugin for less addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")in my file plugins.sbt.

Reproduction documentation says:

Compiled assets on 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 unmanaged assets, which means that there is no difference in how you use them after compilation.

What I do, so I'm confused about why my resources are not 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 try to link the css page in my html file:

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

and finally, here is the error I get in the console:

 GET http://localhost:9000/assets/masterpage.css 
+4
source share
1 answer

By default, sbt-less only searches for a file with a name main.less. If you want to use a different file, you must specify it in the build.sbt file.

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 usually import LESS files from your own main.less.

+6
source

All Articles