This project is a lean and efficient boilerplate for creating static websites using Vite and Tailwind CSS. It's designed to provide a simple, yet powerful solution for businesses that need a fast, optimized website without the complexity of full-fledged content management systems like WordPress.
Many businesses often opt for overly complex solutions when a simple, static website would suffice. This boilerplate offers a streamlined approach:
project-root/
βββ dist/ # Production build output
βββ src/
β βββ components/ # Reusable HTML components
β βββ images/ # Image assets
β βββ js/ # JavaScript files
β βββ scss/ # SCSS files
β βββ sections/ # Larger HTML sections
βββ index.html # Main HTML file
βββ privacy.html # Imprint page
βββ careers.html # Careers page
βββ terms.html # Privacy policy page
βββ package.json # Project dependencies and scripts
βββ tailwind.config.js # Tailwind CSS configuration
βββ vite.config.js # Vite configuration
Clone the repository:
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-name
Install dependencies:
npm install
Start the development server:
npm run dev
Open your browser and visit http://localhost:5173
This boilerplate supports both Tailwind CSS and custom SCSS:
Tailwind classes can be used directly in your HTML files with class="your-tw-class". The configuration file is located at tailwind.config.js
.
For custom styles, use the SCSS files located in the src/scss/
directory. The main SCSS file is src/scss/main.scss
.
This boilerplate uses vite-imagetools
for optimized image handling:
src/images/
directory.data-src
attribute in your HTML to reference images:<img
id="header-2"
data-src="/src/images/header-2.webp"
alt="<!-- TODO: Add alt text -->"
class="rounded-2xl -mt-12 md:mt-0 hidden md:block"
width="1920"
height="1280"
/>
The build process will automatically optimize and generate responsive image sizes.
Use the vite-plugin-html-inject
for HTML templating:
<load src="src/components/navigation.html" />
// or
<load
src="src/components/card.html"
icon="graduation-cap"
color="var(--text-secondary-color)"
title="Service 1"
text="Description of Service 1. Add details about what this service offers and its benefits."
/>
The sitemap is automatically generated based on the configuration in vite.config.js
:
sitemap({
hostname: "https://example-page.de",
exclude: ["/404"],
routes: ["/", "/impressum", "/careers", "/datenschutz", "/#service"],
lastmod: new Date().toISOString(),
changefreq: {
"/": "weekly",
"/impressum": "yearly",
"/datenschutz": "yearly",
"/careers": "monthly",
"/#service": "monthly",
},
priority: {
"/": 1.0,
"/impressum": 0.3,
"/datenschutz": 0.3,
"/careers": 0.7,
"/#service": 0.7,
},
}),
Run the build command:
npm run build
The optimized production files will be in the dist/
directory.
This boilerplate is ready for deployment on various static hosting platforms like Netlify, Vercel, or GitHub Pages. Refer to your chosen platform's documentation for specific deployment instructions.
Tip: In the most basic case, you can use the dist
folder, which is created by the build process, as is and just deploy it to your favorite static site hosting provider.
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
This project is MIT licensed.