Skip to content

Commit 0143c21

Browse files
committed
Initial commit
0 parents  commit 0143c21

23 files changed

+2100
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# ReScript
2+
lib
3+
.merlin
4+
.bsb.lock
5+
6+
# vscode
7+
.vscode/*
8+
!.vscode/settings.json
9+
!.vscode/tasks.json
10+
!.vscode/launch.json
11+
!.vscode/extensions.json
12+
*.code-workspace
13+
14+
# Vite
15+
dist
16+
17+
# npm
18+
node_modules
19+
20+
# macOS
21+
.DS_Store

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build
2+
*.bs.js
3+
*.gen.ts*

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": false,
3+
"jsxSingleQuote": false,
4+
"semi": false,
5+
"tabWidth": 2,
6+
"trailingComma": "all"
7+
}

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["chenglou92.rescript-vscode"]
3+
}

.vscode/settings.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"files.exclude": {
3+
"**/*.bs.js": true,
4+
"dist": true,
5+
"lib": true
6+
}
7+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Anders Bech Mellson
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# ReScript React starter with Tailwind and Vite
2+
3+
This repo is a starter for running ReScript React with Tailwind on Vite.
4+
5+
## Getting started
6+
7+
The project includes a .vscode folder with extension suggestions and setup for running in vscode.
8+
9+
1. Open the folder in vscode and install the suggested extension. Reload vscode.
10+
11+
2. Open a `.res` file, for instance `App.res` and start the build which should be suggested by the popup in the bottom right corner. If there's no popup run `yarn start` and jump to #4.
12+
13+
3. Start Vite by running `yarn dev` in the folder.
14+
15+
4. Open http://localhost:3000 and you should be up and running.

bsconfig.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "rescript-intro",
3+
"sources": [
4+
{
5+
"dir": "src",
6+
"subdirs": true
7+
}
8+
],
9+
"package-specs": [
10+
{
11+
"module": "es6",
12+
"in-source": true
13+
}
14+
],
15+
"suffix": ".bs.js",
16+
"ppx-flags": [],
17+
"reason": { "react-jsx": 3 },
18+
"namespace": true,
19+
"bsc-flags": ["-open Belt"],
20+
"bs-dependencies": ["@rescript/react"]
21+
}

index.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<meta name="theme-color" content="#ffffff" />
7+
<meta name="description" content="ReScript intro" />
8+
9+
<link rel="icon" href="/favicon.svg" />
10+
<link rel="mask-icon" href="/favicon.svg" color="#93b6bc" />
11+
<link rel="icon" href="/favicon.png" />
12+
<link rel="apple-touch-icon" href="/favicon.png" />
13+
14+
<title>ReScript intro</title>
15+
</head>
16+
<body>
17+
<noscript>You need to enable JavaScript to run this app.</noscript>
18+
<div id="root"></div>
19+
<script type="module" src="/src/index.bs.js"></script>
20+
</body>
21+
</html>

package.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "rescript-type-inference-example",
3+
"version": "0.1.0",
4+
"scripts": {
5+
"dev": "vite",
6+
"start": "run-p dev re:start",
7+
"build": "run-s re:build vi:build",
8+
"re:start": "rescript build -w",
9+
"re:build": "rescript build -with-deps",
10+
"vi:build": "vite build",
11+
"serve": "vite serve"
12+
},
13+
"dependencies": {
14+
"@rescript/react": "^0.10.3",
15+
"react": "^17.0.2",
16+
"react-dom": "^17.0.2"
17+
},
18+
"devDependencies": {
19+
"@vitejs/plugin-react-refresh": "^1.3.6",
20+
"autoprefixer": "^10.4.0",
21+
"npm-run-all": "^4.1.5",
22+
"postcss": "^8.3.11",
23+
"rescript": "^9.1.4",
24+
"tailwindcss": "^2.2.19",
25+
"vite": "^2.6.13"
26+
}
27+
}

postcss.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

public/favicon.png

1.88 KB
Loading

public/favicon.svg

+55
Loading

public/robots.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

src/App.bs.js

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.res

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@react.component
2+
let make = () => {
3+
<div className="flex justify-center items-center h-screen">
4+
{React.string("ReScript React with Tailwind running on Vite")}
5+
</div>
6+
}

src/index.bs.js

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@tailwind base;
2+
@tailwind components;
3+
@tailwind utilities;

src/index.res

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
%%raw("import './index.css'")
2+
3+
ReactDOM.render(
4+
<React.StrictMode> <App /> </React.StrictMode>,
5+
ReactDOM.querySelector("#root")->Belt.Option.getExn,
6+
)

tailwind.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
mode: "jit",
3+
purge: {
4+
content: ["./src/**/*.{js,jsx,ts,tsx}", "./index.html"],
5+
safelist: [],
6+
},
7+
darkMode: false, // or 'media' or 'class'
8+
theme: {
9+
extend: {},
10+
},
11+
variants: {
12+
extend: {},
13+
},
14+
plugins: [],
15+
}

vite.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import reactRefresh from "@vitejs/plugin-react-refresh"
2+
import { defineConfig } from "vite"
3+
4+
const config = defineConfig({
5+
plugins: [reactRefresh()],
6+
})
7+
8+
export default config

0 commit comments

Comments
 (0)