I finally had the time to set up a new play (version 2.5.4) project with the activator using the "play-java" template. In my build.sbt i added the following line to use bootstrap with less, as described here.
"org.webjars" % "bootstrap" % "3.3.7"
I also created the folder structure as discribed in the documentation
app
|---> assets
|---> stylesheets
There's just a simple main.less containing the following lines:
@import "lib/bootstrap/less/bootstrap.less";
body {
color: aqua;
}
Now when I'm calling activator run
, activator stage
or activator dist
everything compiles without an error and on calling localhost:9000 the bootstrap is included in the main.css as expected.
EDIT: first i thought the following problem only occurs with heroku but when using sbt clean compile stage
on my local machine I also get the following error:
[info] LESS compiling on 1 source(s)
[error] /tmp/scala_buildpack_build_dir/app/assets/stylesheets/main.less:1: 'lib/bootstrap/less/bootstrap.less' wasn't found. Tried - /tmp/scala_buildpack_build_dir/app/assets/stylesheets/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/app/assets/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/target/web/less/main/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/public/lib/bootstrap/less/bootstrap.less,/tmp/scala_buildpack_build_dir/target/web/web-modules/main/webjars/lib/bootstrap/less/bootstrap.less,lib/bootstrap/less/bootstrap.less
[error] @import "lib/bootstrap/less/bootstrap.less";
[error] ^
[error] one error found
[error] (web-assets:less) com.typesafe.sbt.web.CompileProblemsException
[error] Total time: 5 s, completed Aug 10, 2016 2:53:01 PM
! ERROR: Failed to run sbt!
It seems that with sbt the less compilation can't handle the inclusion of the bootstrap.less coming from an external library while compiling. the activator works fine.
Has anyone else encountered a similar problem, or has an idea what could cause this error?
Normally the less files of the bootstrap webjar should be extracted into target/web/web-modules/main/webjars/lib/bootstrap/less/bootstrap.less
during the build.
But the Jar file of the version you are using misses this files:
bootstrap-3.3.7.jar\META-INF\resources\webjars\bootstrap\3.3.7\
css
fonts
js
webjars-requirejs.js
webjars-requirejs.js.gz
In the version 3.3.4
the less files are existing.