As promised, this is an update from WeApp meets Scala.js leveraging both Scala 3 and Cats Effect
import Wechat.callback
val login = for {
f1 <- Wechat.login
_ <- IO.println(s"code is ${f1.code}")
_ <- Wechat.setStorage("code", f1.code)
} yield ()
login.unsafeRunAsync(callback => {})
A customized sbt-less
can be found in project/lib
, it generates directly .wxss
from the .less
files, either copy it
to your ivy local or add the path in your ~/.sbt/repositories
such as
[repositories]
local
wechat: file:///{baseDirectory}/project/lib, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
sbt > fullOptJS
sbt > less
sbt > assets
- fullOptJS compiles scala files to js files
- less compiles less files to wxss files
- assets copies the rest
Now we have the miniprogram in target
after cleanup, Scala.js generates straight ES6 and it fits miniprograms perfectly
shell $ ./cleanup.sh