Reputation: 2913
I'm using play framework with this plugin. I have the following structure for public
folder;
├───app
│ ├───css
│ ├───img
│ ├───js
│ │ ├───apis
│ │ ├───config
│ │ ├───controllers
│ │ ├───directives
│ │ ├───filters
│ │ ├───locale
│ │ └───services
│ └───views
└───test
In build.sbt
, I have the following;
includeFilter in (Assets, LessKeys.less) := "*.less"
excludeFilter in (Assets, LessKeys.less) := "_*.less"
LessKeys.rootpath in Assets := "public/app/css"
In my main.scala.html
, I have the following link tag;
<link rel="stylesheet" href='@routes.Assets.at("app/css/main.css")'>
And lastly, my routes
has the following;
GET /assets/*file controllers.Assets.at(path="/public", file)
However, less configuration in build.sbt doesn't seem to work. I want to compile public/app/css/main.less. How can I achieve this ?
Upvotes: 1
Views: 453
Reputation: 6174
The default path to assets defined in the SbtWeb plugin is: app/assets
:
sourceDirectory in Assets := (sourceDirectory in Compile).value / "assets"
so it can easily be overridden:
sourceDirectory in Assets := (sourceDirectory in Compile).value / "path" / "to" / "assets"
Upvotes: 0
Reputation: 55569
According to the Play documentation:
Compilable assets in Play must be defined in the
app/assets
directory.
And the sbt-less readme:
Set rootpath for url rewriting in relative imports and urls.
It seems like there is no way to do this, as Play needs a place where it can expect compilable assets and not Scala/Java code. The rootpath
key appears to just be for re-writing imports/urls in LESS files.
What you need is:
├───app
│ ├───assets
│ │ ├───css
│ │ ├───img
│ │ └───js
│ │ ├───apis
│ │ ├───config
│ │ ├───controllers
│ │ ├───directives
│ │ ├───filters
│ │ ├───locale
│ │ └───services
│ └───views
└───test
Upvotes: 1