npx degit solidjs/templates/js my-app
cd my-app
npm i # or yarn or pnpm
npm run dev # or yarn or pnpm
npx degit solidjs/templates/ts my-app
cd my-app
npm i # or yarn or pnpm
npm run dev # or yarn or pnpm
-
solid-app-router:
https://github.com/solidjs/solid-app-routernpm i solid-app-router
-
tailwindcss:
https://dev.to/wobsoriano/install-tailwind-css-in-solid-and-vite-jflnpm i -D tailwindcss@latest postcss@latest autoprefixer@latest
Next, generate
tailwind.config.js
andpostcss.config.js
files by this command:npx tailwindcss init -p
Open the
tailwind.config.js
file and update thepurge
property to include the path to oursrc
folder andindex.html
file.module.exports = { purge: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], darkMode: false, // or 'media' or 'class' theme: { extend: {}, }, variants: { extend: {}, }, plugins: [], }
Next, we’ll import Tailwind’s styles using the
@tailwind
directive within our entry CSS file:/* ./src/index.css */ @tailwind base; @tailwind components; @tailwind utilities;
Finally, ensure your CSS file is being imported in your
./src/index.js
or./src/index.ts
file:import { render } from "solid-js/web"; import "./index.css"; import App from "./App"; render(() => <App />, document.getElementById("root"));
-
Or we can use
Vite + Solid + Tailwind CSS starter:
https://github.com/wobsoriano/vite-solid-tailwind-starter
FunctionComponent
=>Component
useMemo
=>createMemo
> no need dependencies for createMemoonChange
=>onKeyUp
e.target.value
=>e.currentTarget.value
- instead of
map
, we use<For></For>
on solid-js. Also no needkey
for that. useState
=>createSignal
useEffect
=>createResource
npm run deploy
We can deploy the dist
folder to any static host provider (netlify, surge, now, etc.)