Pickup js-deps
giovannicandido opened this issue · 3 comments
With the configuration skip in packageJSDependencies := false
scalajs compiler creates a file called module-jsdeps.js.
Is nice if the plugin could get automatically this file in @playscalajs.html.scripts("/assets", projectName = "module")
template
Hi @giovannicandido,
FYI, the scripts are in this repository https://github.com/vmunier/play-scalajs-scripts and are independent of the sbt-play-scalajs plugin.
We would have to check if the file exists before including it to not get a 404 NotFound. To check if the resource exists, the resource base path for assets (often set to /public
) would have to be passed as an argument in the playscalajs.html.scripts
template.
So in my opinion playscalajs.html.scripts
should stay as is. But you can simply add one line yourself to your Play template if you have set skip in packageJSDependencies := false
, e.g.:
<script src="@routes.Assets.at("exampleclient-jsdeps.js")" type="text/javascript"></script>
I think the routes.Assets.at could be used to infer the location. When I get a time I will look at this
Hi,
play-scalajs-scripts v0.2.0
has been published.
- It includes a
playscalajs.html.jsdeps
template which is also used byplayscalajs.html.scripts
. - Note that the usage and order of the arguments in the different scripts have changed.
You should now call@playscalajs.html.scripts("exampleClient")
where you previously called@playscalajs.html.scripts("/assets", projectName = "exampleClient")
See vmunier/scalajs-scripts#2 for more details on jsdeps support.
Cheers,
Vincent