diff --git a/README.md b/README.md new file mode 100644 index 0000000..60596e4 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +## Install + +`npx degit amoutonbrady/vite-template-solid/js` for Javascript +`npx degit amoutonbrady/vite-template-solid/ts` for Typescript + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+ +### `npm run build` + +Builds the app for production to the `dist` folder.
+It correctly bundles Solid in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +## Deployment + +You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.) diff --git a/js/.gitignore b/js/.gitignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/js/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/js/README.md b/js/README.md new file mode 100644 index 0000000..60596e4 --- /dev/null +++ b/js/README.md @@ -0,0 +1,27 @@ +## Install + +`npx degit amoutonbrady/vite-template-solid/js` for Javascript +`npx degit amoutonbrady/vite-template-solid/ts` for Typescript + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser. + +The page will reload if you make edits.
+ +### `npm run build` + +Builds the app for production to the `dist` folder.
+It correctly bundles Solid in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.
+Your app is ready to be deployed! + +## Deployment + +You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.) diff --git a/js/package.json b/js/package.json new file mode 100644 index 0000000..bfc6774 --- /dev/null +++ b/js/package.json @@ -0,0 +1,17 @@ +{ + "name": "vite-template-solid", + "version": "0.0.0", + "description": "My solid + vite project", + "scripts": { + "start": "vite", + "build": "vite build" + }, + "license": "ISC", + "devDependencies": { + "@amoutonbrady/vite-plugin-solid": "^0.0.3", + "vite": "^1.0.0-beta.11" + }, + "dependencies": { + "solid-js": "^0.18.12" + } +} diff --git a/js/src/App.css b/js/src/App.css new file mode 100644 index 0000000..af7f93b --- /dev/null +++ b/js/src/App.css @@ -0,0 +1,33 @@ +.App { + text-align: center; +} + +.App-logo { + animation: App-logo-spin infinite 20s linear; + height: 40vmin; + pointer-events: none; +} + +.App-header { + background-color: #282c34; + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + font-size: calc(10px + 2vmin); + color: white; +} + +.App-link { + color: #b318f0; +} + +@keyframes App-logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} diff --git a/js/src/App.js b/js/src/App.js new file mode 100644 index 0000000..1d726b6 --- /dev/null +++ b/js/src/App.js @@ -0,0 +1,25 @@ +import logo from "./logo.svg"; +import "./App.css"; + +function App() { + return ( +
+
+ +

+ Edit src/App.js and save to reload. +

+ + Learn Solid + +
+
+ ); +} + +export default App; diff --git a/js/src/assets/favicon.ico b/js/src/assets/favicon.ico new file mode 100644 index 0000000..dd05500 Binary files /dev/null and b/js/src/assets/favicon.ico differ diff --git a/js/src/index.css b/js/src/index.css new file mode 100644 index 0000000..4a1df4d --- /dev/null +++ b/js/src/index.css @@ -0,0 +1,13 @@ +body { + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +code { + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", + monospace; +} diff --git a/js/src/index.html b/js/src/index.html new file mode 100644 index 0000000..983c891 --- /dev/null +++ b/js/src/index.html @@ -0,0 +1,16 @@ + + + + + + + + Solid App + + + +
+ + + + diff --git a/js/src/index.js b/js/src/index.js new file mode 100644 index 0000000..33a4ffc --- /dev/null +++ b/js/src/index.js @@ -0,0 +1,18 @@ +import { render } from "solid-js/dom"; + +import "./index.css"; +import App from "./App"; + +const rootEl = document.getElementById("root"); +const dispose = render(() => App, rootEl); + +// HMR stuff, this will be automatically removed during build +// /!\ You need to add "vite" in the "compilerOptions.types" of your tsconfig.json +// if you want to avoid type errors here +if (import.meta.hot) { + import.meta.hot.accept(); + import.meta.hot.dispose(() => { + dispose(); + rootEl.textContent = ""; + }); +} diff --git a/js/src/logo.svg b/js/src/logo.svg new file mode 100644 index 0000000..025aa30 --- /dev/null +++ b/js/src/logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/js/vite.config.js b/js/vite.config.js new file mode 100644 index 0000000..26cd4ad --- /dev/null +++ b/js/vite.config.js @@ -0,0 +1,14 @@ +import { solidPlugin } from "@amoutonbrady/vite-plugin-solid"; + +/** + * @type {import('vite').UserConfig} + */ +const config = { + root: "src", + outDir: "dist", + serviceWorker: false, + plugins: [solidPlugin()], + enableEsbuild: false, +}; + +export default config;