A Gatsby starter for writing your site in ReasonML
Installation using the gatsby cli
gatsby new my-reasonml-site https://github.com/jtberglund/gatsby-starter-reason
Check the docs for gatsby-plugin-reason for more details on configuration options.
gatsby-plugin-reason
offers an option to derive page routes from the page component's name (instead of the file name like gatsby usually uses), which is in use in this starter (see the plugin configuration in gatsby-config.js).
I prefer using this option for two reasons:
- ReasonML/ocaml has fairly strict rules for files names since file names automatically map to module names, meaning file names for page components such as
about-me.re
or404.re
are not allowing. - I like to uppercase my component names and I don't like having two naming conventions going on at once (e.g. having
src/components/Header.re
alongsidesrc/pages/my_page.re
).
This allows you to create a page component called AboutMe.re
and map it to the route /about-me
by setting the name of your component to "about-me"
as shown below:
let component = ReasonReact.statelessComponent("about-me");
WIP
If there are issues compiling your ReasonML code and you're sure its not a syntax error, often re-compiling will fix the error
bsb -clean-world
bsb -make-world