|
| 1 | +# 🚀 Vite Vanilla JS & Sass Supercharged Starter |
| 2 | + |
| 3 | +A fast, modern template for vanilla JavaScript and Sass, powered by [Vite](https://vitejs.dev/). This setup includes comprehensive linting for HTML, CSS, and JS, uses modern-normalize for CSS resets, and demonstrates a streamlined, framework-free approach to frontend development. Enjoy optimized performance, strict code quality, and robust legacy browser support. |
| 4 | + |
| 5 | +## ✨ Features |
| 6 | + |
| 7 | +- ⚡️ Lightning-fast development with Vite |
| 8 | +- 🧼 Built-in linting for HTML, JavaScript, and SCSS using ESLint, Stylelint, and HTMLHint |
| 9 | +- 🖼️ Automatic image optimization |
| 10 | +- 🧱 Zero frameworks: Pure Vanilla JavaScript and Sass |
| 11 | +- 🔧 Minified, customizable HTML templates via `vite-plugin-html` |
| 12 | +- 🕸️ Legacy browser compatibility with `@vitejs/plugin-legacy` |
| 13 | +- 🌀 Automatic CSS vendor prefixing with [Autoprefixer](https://github.com/postcss/autoprefixer) |
| 14 | + |
| 15 | +## 📦 Tech Stack |
| 16 | + |
| 17 | +- **Build tool:** [Vite](https://vitejs.dev/) |
| 18 | +- **JavaScript:** Vanilla JS |
| 19 | +- **Preprocessor:** [Sass Embedded](https://sass-lang.com/dart-sass/) |
| 20 | +- **CSS reset:** [modern-normalize](https://github.com/sindresorhus/modern-normalize) |
| 21 | +- **Linting:** [ESLint](https://eslint.org/), [Stylelint](https://stylelint.io/), [HTMLHint](https://htmlhint.com/) — ensuring consistent, high-quality code |
| 22 | +- **Image compression:** [vite-plugin-imagemin](https://github.com/vbenjs/vite-plugin-imagemin) |
| 23 | +- **HTML minification/templates:** [vite-plugin-html](https://github.com/vbenjs/vite-plugin-html) |
| 24 | +- **PostCSS:** [Autoprefixer](https://github.com/postcss/autoprefixer) |
| 25 | +- **Legacy support:** [@vitejs/plugin-legacy](https://vitejs.dev/plugins/#vitejs/plugin-legacy) |
| 26 | + |
| 27 | +## 🧪 Project Structure |
| 28 | + |
| 29 | +- `src/` – Main source files (HTML, JS, SCSS, assets) |
| 30 | +- `dist/` – Production build output (generated) |
| 31 | +- `index.html` – Entry HTML file with plugin support |
| 32 | +- `vite.config.js` – Custom Vite configuration with plugins and aliases |
| 33 | +- `postcss.config.js` – PostCSS configuration (Autoprefixer, etc.) |
| 34 | +- `.eslintrc`, `.stylelintrc`, `.htmlhintrc` – Dedicated linting configurations for maximum code quality |
| 35 | +- `package.json` – Project dependencies and scripts |
| 36 | + |
| 37 | +## 🧩 Vite Plugins |
| 38 | + |
| 39 | +- **[vite-plugin-html](https://github.com/vbenjs/vite-plugin-html):** |
| 40 | + Compresses HTML, supports EJS-like templating, and enables multi-page apps. |
| 41 | +- **[vite-plugin-imagemin](https://github.com/vbenjs/vite-plugin-imagemin):** |
| 42 | + Optimizes images (JPEG, PNG, SVG, etc.) during build. |
| 43 | +- **[vite-plugin-eslint2](https://vite-plugin-eslint2.modyqyw.top/):** |
| 44 | + Enforces JavaScript linting during development and build with ESLint. |
| 45 | +- **[vite-plugin-stylelint](https://vite-plugin-stylelint.modyqyw.top/):** |
| 46 | + Applies Stylelint checks to SCSS/CSS for consistent, high-quality styles. |
| 47 | +- **[@vitejs/plugin-legacy](https://vitejs.dev/plugins/#vitejs/plugin-legacy):** |
| 48 | + Ensures compatibility with older browsers by generating legacy bundles. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 🚀 Getting Started |
| 53 | + |
| 54 | +### Requirements |
| 55 | + |
| 56 | +Node.js ≥ 18.x |
| 57 | + |
| 58 | +### Installation |
| 59 | + |
| 60 | +```bash |
| 61 | +npm install |
| 62 | +``` |
| 63 | + |
| 64 | +### Development |
| 65 | + |
| 66 | +```bash |
| 67 | +npm run dev |
| 68 | +# → Starts the local dev server at http://localhost:3000 |
| 69 | +``` |
| 70 | + |
| 71 | +### Production |
| 72 | + |
| 73 | +```bash |
| 74 | +npm run build |
| 75 | +# → Builds the static site into dist/ |
| 76 | + |
| 77 | +npm run preview |
| 78 | +# → Serves the production build locally for testing |
| 79 | +``` |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## 🧹 Linting |
| 84 | + |
| 85 | +Lint your code manually using the following CLI commands: |
| 86 | + |
| 87 | +- **ESLint (JavaScript):** |
| 88 | + ```bash |
| 89 | + npx eslint src/ |
| 90 | + ``` |
| 91 | +- **Stylelint (SCSS/CSS):** |
| 92 | + ```bash |
| 93 | + npx stylelint "src/**/*.scss" |
| 94 | + ``` |
| 95 | +- **HTMLHint (HTML):** |
| 96 | + ```bash |
| 97 | + npx htmlhint "src/**/*.html" |
| 98 | + ``` |
| 99 | + |
| 100 | +You can also configure these as npm scripts in your `package.json` for convenience. |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## 🤝 Contributing |
| 105 | + |
| 106 | +Contributions are welcome! Feel free to open issues or submit pull requests to improve this template. |
| 107 | + |
| 108 | +## 📝 License |
| 109 | + |
| 110 | +This project is licensed under the [MIT License](LICENSE). |
| 111 | + |
| 112 | +## 👤 Author |
| 113 | + |
| 114 | +Created with passion by [Marco Pontili](https://marcopontili.com) - [GitHub](https://github.com/marcop135). |
0 commit comments