https://github.com/0x80/gatsby-reasonml-site
A personal playground for learning ReasonML
https://github.com/0x80/gatsby-reasonml-site
Last synced: about 1 month ago
JSON representation
A personal playground for learning ReasonML
- Host: GitHub
- URL: https://github.com/0x80/gatsby-reasonml-site
- Owner: 0x80
- License: mit
- Created: 2020-08-08T13:42:51.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-08T14:00:20.000Z (over 4 years ago)
- Last Synced: 2025-02-05T09:18:42.187Z (3 months ago)
- Language: CSS
- Size: 286 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gatsby-starter-reason
A Gatsby starter for writing your site in ReasonML
## Installation
Installation using the [gatsby cli](https://www.npmjs.com/package/gatsby-cli)
```
gatsby new my-reasonml-site https://github.com/jtberglund/gatsby-starter-reason
```## Usage
Check the docs for [gatsby-plugin-reason](https://github.com/jtberglund/gatsby-plugin-reason) for more details on configuration options.
### Pages
`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](https://github.com/jtberglund/gatsby-starter-reason/blob/master/gatsby-config.js)).
I prefer using this option for two reasons:
1. 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` or `404.re` are not allowing.
2. 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` alongside `src/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:
```ocaml
let component = ReasonReact.statelessComponent("about-me");
```### GraphQL
WIP
## Troubleshooting
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
```