Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sjrd/scalajs-sbt-vite-laminar-chartjs-example
An example of using Scala.js with sbt, Vite, Laminar and Chart.js
https://github.com/sjrd/scalajs-sbt-vite-laminar-chartjs-example
Last synced: 9 days ago
JSON representation
An example of using Scala.js with sbt, Vite, Laminar and Chart.js
- Host: GitHub
- URL: https://github.com/sjrd/scalajs-sbt-vite-laminar-chartjs-example
- Owner: sjrd
- License: apache-2.0
- Created: 2022-05-12T14:31:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-22T08:21:46.000Z (4 months ago)
- Last Synced: 2024-10-16T14:09:54.341Z (23 days ago)
- Language: Scala
- Size: 62.5 KB
- Stars: 88
- Watchers: 3
- Forks: 18
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - sjrd/scalajs-sbt-vite-laminar-chartjs-example - An example of using Scala.js with sbt, Vite, Laminar and Chart.js (Scala)
README
# Scala.js with sbt, Vite, Laminar and Chart.js
This is an example of putting together:
* [Scala.js](https://www.scala-js.org/)
* [sbt](https://www.scala-sbt.org/)
* [Vite](https://vitejs.dev/)
* [Laminar](https://laminar.dev/)
* [Chart.js](https://www.chartjs.org/), statically typed with [ScalablyTyped](https://scalablytyped.org/)If you don't want the project walkthrough in its entirety, you can specify up to which stage of the guide to include by cloning a specific branch:
* [Vite](https://github.com/sjrd/scalajs-sbt-vite-laminar-chartjs-example/tree/scalajs-vite-end-state)
* [Vite + Laminar](https://github.com/sjrd/scalajs-sbt-vite-laminar-chartjs-example/tree/laminar-end-state)
* [Vite + Laminar + ScalablyTyped](https://github.com/sjrd/scalajs-sbt-vite-laminar-chartjs-example/tree/scalablytyped-end-state)## Install
You need to explicitly install the following software:
* sbt, as part of [getting started with Scala](https://docs.scala-lang.org/getting-started/index.html) (or if you prefer, through [its standalone download](https://www.scala-sbt.org/download.html))
* [Node.js](https://nodejs.org/en/)Other software will be downloaded automatically by the commands below.
## Prepare
Before doing anything, including before importing in an IDE, run
```
$ npm install
```## Development
Open two terminals.
In the first one, start `sbt` and, within, continuously build the Scala.js project:```
$ sbt
...
> ~fastLinkJS
...
```In the second one, start the Vite development server with
```
$ npm run dev
...
```Follow the URL presented to you by Vite to open the application.
You can now continuously edit the `Main.scala` file, and Vite will automatically reload the page on save.
## Production build
Make a production build with
```
$ npm run build
```You can then find the built files in the `dist/` directory.
You will need an HTTP server, such as `python3 -m http.server`, to open the files, as Vite rewrites `` tags to prevent cross-origin requests.