diff --git a/demo/react-app/README.md b/demo/react-app/README.md deleted file mode 100644 index 74872fd..0000000 --- a/demo/react-app/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# React + TypeScript + Vite - -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. - -Currently, two official plugins are available: - -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default tseslint.config({ - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) -``` - -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` -- Optionally add `...tseslint.configs.stylisticTypeChecked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: - -```js -// eslint.config.js -import react from 'eslint-plugin-react' - -export default tseslint.config({ - // Set the react version - settings: { react: { version: '18.3' } }, - plugins: { - // Add the react plugin - react, - }, - rules: { - // other rules... - // Enable its recommended rules - ...react.configs.recommended.rules, - ...react.configs['jsx-runtime'].rules, - }, -}) -``` diff --git a/demo/react-app/src/index.css b/demo/react-app/src/index.css index c54ee7d..2c7a5e8 100644 --- a/demo/react-app/src/index.css +++ b/demo/react-app/src/index.css @@ -2,3 +2,40 @@ color: rgba(255, 255, 255, 0.87); background-color: #242424; } + +p { + font-size: x-large; +} + +.google-poppins { + font-family: "Poppins", sans-serif; +} + +.google-press-start { + font-family: "Press Start 2P", sans-serif; +} + +.bunny-aclonica { + font-family: "Aclonica", sans-serif; +} + +.bunny-allan { + font-family: "Allan", sans-serif; +} + +.font-share-panchang { + font-family: "Panchang", sans-serif; +} + +.font-source-luckiest { + font-family: "Luckiest Guy", sans-serif; +} + +@font-face { + font-family: "Black Fox"; + src: url("./black-fox.ttf"); +} + +.local { + font-family: "Black Fox", sans-serif; +} diff --git a/demo/vanilla-app/.gitignore b/demo/vanilla-app/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/demo/vanilla-app/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/demo/vanilla-app/index.html b/demo/vanilla-app/index.html new file mode 100644 index 0000000..44a9335 --- /dev/null +++ b/demo/vanilla-app/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + TS + + +
+ + + diff --git a/demo/vanilla-app/package.json b/demo/vanilla-app/package.json new file mode 100644 index 0000000..83ddcb8 --- /dev/null +++ b/demo/vanilla-app/package.json @@ -0,0 +1,15 @@ +{ + "name": "vanilla-app", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "typescript": "~5.6.2", + "vite": "^6.0.5" + } +} diff --git a/demo/vanilla-app/public/vite.svg b/demo/vanilla-app/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/demo/vanilla-app/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/demo/vanilla-app/src/black-fox.ttf b/demo/vanilla-app/src/black-fox.ttf new file mode 100644 index 0000000..9497048 Binary files /dev/null and b/demo/vanilla-app/src/black-fox.ttf differ diff --git a/demo/vanilla-app/src/main.ts b/demo/vanilla-app/src/main.ts new file mode 100644 index 0000000..fa75ba7 --- /dev/null +++ b/demo/vanilla-app/src/main.ts @@ -0,0 +1,22 @@ +import './style.css'; + +document.querySelector('#app')!.innerHTML = ` +
+

Google

+

Poppins

+

Press Start 2P

+ +

Bunny

+

Aclonica

+

Allan

+ +

FontShare

+

Panchang

+ +

FontSource

+

Luckiest

+ +

Local

+

Local font

+
+`; diff --git a/demo/vanilla-app/src/style.css b/demo/vanilla-app/src/style.css new file mode 100644 index 0000000..2c7a5e8 --- /dev/null +++ b/demo/vanilla-app/src/style.css @@ -0,0 +1,41 @@ +:root { + color: rgba(255, 255, 255, 0.87); + background-color: #242424; +} + +p { + font-size: x-large; +} + +.google-poppins { + font-family: "Poppins", sans-serif; +} + +.google-press-start { + font-family: "Press Start 2P", sans-serif; +} + +.bunny-aclonica { + font-family: "Aclonica", sans-serif; +} + +.bunny-allan { + font-family: "Allan", sans-serif; +} + +.font-share-panchang { + font-family: "Panchang", sans-serif; +} + +.font-source-luckiest { + font-family: "Luckiest Guy", sans-serif; +} + +@font-face { + font-family: "Black Fox"; + src: url("./black-fox.ttf"); +} + +.local { + font-family: "Black Fox", sans-serif; +} diff --git a/demo/vanilla-app/src/vite-env.d.ts b/demo/vanilla-app/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/demo/vanilla-app/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/demo/vanilla-app/tsconfig.json b/demo/vanilla-app/tsconfig.json new file mode 100644 index 0000000..a4883f2 --- /dev/null +++ b/demo/vanilla-app/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/demo/vanilla-app/vite.config.ts b/demo/vanilla-app/vite.config.ts new file mode 100644 index 0000000..d00b392 --- /dev/null +++ b/demo/vanilla-app/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite'; +import { fontless } from '../../lib/vite/plugin'; + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [fontless()], +});