I never set out to create a boilerplate, but after making sites dozens of times, I realized there were familiar patterns I was reaching for, and I'd always copy that code out of my last project. The most recent time, I decided to strip everything out into a boilerplate.
This is the starting point that I (Lemon) use every time I make a new website. It's built using my own aesthetics.
I want to have reusable components to help me make a static HTML site, and I want to do that as quickly as possible. At the same time, I don't want to have a whole bunch of boilerplate stuff in the shipped code. The idea here is only when you need it: Making something that's slim and extendable.
This project uses npm for build tooling, with Pug for HTML templating, Sass for CSS, and TypeScript for JavaScript.
This also assumes you want to write in Vue, Sass & Pug.
You'll need Node.js (v18 or higher) and npm installed. If you don't have them, download Node.js here (npm comes with it).
- Click Use This Template to use this repo as a project template.
- Clone your new repository locally
- Run
npm installto install dependencies - Run
npm run setupto configure your project name and details - Run
npm run devto start the development server - If you see It works. in the middle of the screen, congratulations it's working right.
npm install- Install all dependenciesnpm run setup- Initial project setup (prompts for project name, URL, etc.)npm run dev- Start development server with live reloadnpm run build- Build all files for productionnpm test- Check for Sass and TypeScript errors
I'll break this down into three sections, Pug, Sass, & TypeScript.
For detailed information about routing configuration, see the Pug Routing Documentation.
- Pug - HTML templating with routing configuration in
routes/pug.routes.ts - Sass - Modern CSS with @use syntax
- TypeScript - Type-safe JavaScript
- Development Tools - Prettier, BrowserSync, and other helpful tools
If you want to deploy this project to GitHub Pages, follow these steps:
- Navigate to the
.github/workflows/directory. - Rename the
deploy.yml.examplefile todeploy.yml. - Commit and push the changes to your repository.
- GitHub Actions will automatically run the workflow to deploy your site to GitHub Pages.
Make sure your repository settings are configured to use GitHub Pages, and the branch is set to github-pages or the branch specified in the workflow file.