Skip to content

Commit 5c3839d

Browse files
authored
Make it compatible with sbt-web-scalajs v1.2.0 for main.js (#55)
* Make it compatible with sbt-web-scalajs v1.2.0 for main.js * Upgrade to latest libraries * Update README.md
1 parent 86ce13d commit 5c3839d

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

README.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,11 @@ Small library which provides a way to link Scala.js output to HTML templating en
77
[twirl](https://github.com/playframework/twirl), [scalatags](https://github.com/lihaoyi/scalatags) or even
88
standard scala string interpolation.
99

10-
11-
## When using sbt-web-scalajs `v1.2.0` or higher
12-
13-
*scalajs-scripts is deprecated when using sbt-web-scalajs `v1.2.0` or higher. The recommended approach is to create a template helper in the project itself. Example of a `findScript.scala.html` template in [Play](https://github.com/vmunier/play-scalajs.g8/blob/856e70e60f518db27cd8db524abf0bed1d0fc59d/src/main/g8/server/app/views/findScript.scala.html) and [Akka HTTP](https://github.com/vmunier/akka-http-scalajs.g8/blob/961276766e4c69caf9ad6aee9a14b283cc2bc946/src/main/g8/server/src/main/twirl/%24package%24/findScript.scala.html).*
14-
15-
## When using sbt-web-scalajs `v1.1.0` or lower
16-
1710
## Setup
1811

1912
Add the library to `build.sbt`:
2013
```
21-
libraryDependencies += "com.vmunier" %% "scalajs-scripts" % "1.1.4"
14+
libraryDependencies += "com.vmunier" %% "scalajs-scripts" % "1.2.0"
2215
```
2316

2417
## Integration with Twirl

build.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ inThisBuild(List(
1414
))
1515

1616
name := "scalajs-scripts"
17-
scalaVersion := "2.13.2"
18-
crossScalaVersions := Seq("2.12.11", scalaVersion.value)
17+
scalaVersion := "2.13.6"
18+
crossScalaVersions := Seq("2.12.14", scalaVersion.value)
1919

2020
enablePlugins(SbtTwirl)
2121

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.5.3
1+
sbt.version=1.5.4

src/main/twirl/scalajs/selectScript.scala.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66

77
@defining(s"${projectName.toLowerCase}") { name =>
88
@{
9-
val possibleArtifacts = Seq(s"$name-opt-bundle.js", s"$name-fastopt-bundle.js", s"$name-opt/main.js", s"$name-fastopt/main.js")
9+
val possibleArtifacts = Seq(
10+
s"$name-opt-bundle.js",
11+
s"$name-fastopt-bundle.js",
12+
s"$name-opt/main.js",
13+
s"$name-fastopt/main.js",
14+
s"$name-opt.js",
15+
s"$name-fastopt.js"
16+
)
1017
possibleArtifacts.find(resourceExists).map(filename => jsScript(assets(filename), htmlAttributes))
1118
}
1219
}

0 commit comments

Comments
 (0)