ScalaJS Getting Started
In the subdirectory myapp/project
, we add two files: build.properties
and plugins.sbt
Create src/main/scala/myapp/App.scala
file:
Compile scala code to javascript and also watch for changes:
Update main.js
file as follow:
Now, start the dev server:
Visit: http://localhost:5173
Your project structure should look like this:
You can run the following command to create a new project using the template:
Source code on github: https://github.com/scala-js/vite.g8
Update the build.sbt
file to add laminar
dependency:
Then, update our App.scala
file to use Laminar:
Run concurrently $ sbt "~fastLinkJS"
and $ npm run dev
to see the changes.
Update the build.sbt
file to add scalajs-react
dependency:
Update our App.scala
file to use ScalaJS-React:
Run concurrently $ sbt "~fastLinkJS"
and $ npm run dev
to see the changes.
Update style.css
file:
Update tailwind.config.js
file:
Update App.scala
file: