README
SolidJS-Shop
create project by JavaScript template
npx degit solidjs/templates/js my-app
cd my-app
npm i # or yarn or pnpm
npm run dev # or yarn or pnpm
create project by TypeScript template
npx degit solidjs/templates/ts my-app
cd my-app
npm i # or yarn or pnpm
npm run dev # or yarn or pnpm
install plugin
-
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@latestNext, generate
tailwind.config.jsandpostcss.config.jsfiles by this command:npx tailwindcss init -pOpen the
tailwind.config.jsfile and update thepurgeproperty to include the path to oursrcfolder andindex.htmlfile.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
@tailwinddirective 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.jsor./src/index.tsfile: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
changes
FunctionComponent=>ComponentuseMemo=>createMemo> no need dependencies for createMemoonChange=>onKeyUpe.target.value=>e.currentTarget.value- instead of
map, we use<For></For>on solid-js. Also no needkeyfor that. useState=>createSignaluseEffect=>createResource
Deployment
npm run deploy
We can deploy the dist folder to any static host provider (netlify, surge, now, etc.)