Skip to content

Commit

Permalink
Add rescript template
Browse files Browse the repository at this point in the history
  • Loading branch information
bodhish committed Apr 12, 2021
1 parent 21e6241 commit 6547f9c
Show file tree
Hide file tree
Showing 17 changed files with 7,585 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![npm version](https://badge.fury.io/js/create-reason-react-tailwind.svg)](https://badge.fury.io/js/create-reason-react-tailwind)

# Create Reason React App
# Create Rescript / Reason React App

Reason react boilerplate generator
Rescript & Reason react boilerplate generator

## Quick Start

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-reason-react-tailwind",
"version": "0.7.1",
"version": "0.8.0",
"description": "A reason react starter with tailwind and webpack",
"scripts": {
"start": "node index.js"
Expand All @@ -15,6 +15,7 @@
"BuckleScript",
"ReasonReact",
"reason-react",
"Rescipt",
"tailwind",
"webpack"
],
Expand Down
11 changes: 11 additions & 0 deletions templates/rescript-webpack/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/lib/bs/
/node_modules/
/bundleOutput/
/build

# Ignore these associated with reason-react and bsb
.merlin
npm-debug.log
.DS_Store
.bsb.lock
*.bs.js
32 changes: 32 additions & 0 deletions templates/rescript-webpack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# RE-Tailwind

## Run Project

```sh
npm install
npm start
# in another tab
npm run webpack
```

After you see the webpack compilation succeed (the `npm run webpack` step), open up `build/index.html` (**no server needed!**). Then modify whichever `.re` file in `src` and refresh the page to see the changes.

## Run Project with Server

To run with the webpack development server run `npm run server` and view in the browser at http://localhost:8000. Running in this environment provides hot reloading and support for routing; just edit and save the file and the browser will automatically refresh.

Note that any hot reload on a route will fall back to the root (`/`), so `ReasonReact.Router.dangerouslyGetInitialUrl` will likely be needed alongside the `ReasonReact.Router.watchUrl` logic to handle routing correctly on hot reload refreshes or simply opening the app at a URL that is not the root.

To use a port other than 8000 set the `PORT` environment variable (`PORT=8080 npm run server`)

## gitignore

rename `gitignore` to `.gitignore`

## Build for Production

```sh
npm run clean
npm run build
npm run webpack:production
```
21 changes: 21 additions & 0 deletions templates/rescript-webpack/bsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "react-hooks-template",
"reason": {
"react-jsx": 3
},
"sources": {
"dir": "src",
"subdirs": true
},
"bsc-flags": ["-bs-super-errors", "-bs-no-version-header"],
"package-specs": [
{
"module": "commonjs",
"in-source": true
}
],
"suffix": ".bs.js",
"namespace": true,
"bs-dependencies": ["@rescript/react"],
"refmt": 3
}
11 changes: 11 additions & 0 deletions templates/rescript-webpack/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/lib/bs/
/node_modules/
/bundleOutput/
/build

# Ignore these associated with reason-react and bsb
.merlin
npm-debug.log
.DS_Store
.bsb.lock
*.bs.js
9 changes: 9 additions & 0 deletions templates/rescript-webpack/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[build]
base = ""
publish = "build"
command = "npm i && npm run clean && npm run build && npm run webpack:production"

[[redirects]]
from = "/*"
to = "/index.html"
status = 200
Loading

0 comments on commit 6547f9c

Please sign in to comment.