Quick trial. Don't use it for something serious. Quite slow.
cd gatsby
gatsby develop
Uses Slinky
cd scalajs
sbt ~bundle
This is only a proof of concept.
- Compiles
scala
files and exports a single JS file usingscala-bundler
(fastOptJS) - Single JS file is copied to
gatsby/src
folder - Gatsby takes over and reloads the site
// gatsby/src/index.js
import { Components } from "../scalajs-gatsby-fastopt"
const { MyComponent } = Components
const IndexPage = () =>
<Layout>
<SEO title="Home" />
<h1>Hi people</h1>
<MyComponent name="Gatbsy" />
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<div style={{ maxWidth: `300px`, marginBottom: `1.45rem` }}>
<Image />
</div>
<Link to="/page-2/">Go to page 2</Link>
</Layout>
MyComponent
is written in scala
using slinky
.
It is a React Component that Gatsby can render.
Reloading takes time : not less than 10+ seconds betweek scala files edit and gatbsy site update