I've created a starter template which is named VITAM for front-end development. This template focuses on building a static website and suits small to medium projects like a landing page and a corporate website.
VITAM provides some features to increase productivity for front-end developers.
You can get these benefits and features from VITAM.
- Fast HMR with Vite
- PWA support
- Quick local server
- Compressing image assets
- Breaking HTML smaller files with Handlebars
- Referring to Enduring CSS
- Out of the box useful JavaScript libraries
- Out of the box useful SCSS functions and Mixins
- Checking TypeScript with ESLint
- HTML Validation with HTML-validate
- Transforming styles with PostCSS
- Built-in test runner with Jest
Requirements to use VITAM
Before you start using VITAM, make sure you do these following tasks.
- Install Node.js(Node v16+)
- Install Yarn
Here is recommeded tools but they are not necessary.
Creating a repository from a template
You can directly generate a new repository from VITAM's repository.
Please click Use this template.
Creating a repository from a template
Clone your project
Clone the repository you generated from VITAM.
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
Install packages
Install all dependencies for a project with bellow command.
yarn install
Start development
Run a build command after installed packages.
yarn build
And then, run a start command.
yarn start
That's all to do before you start project.
Let's enjoy development!
Template detail
I've written down below the infomation you should know to use VITAM.
HTML
You can handle bundling multiple HTML files with vite-plugin-handlebars.
Make sure Handlebars Context as you need.
If you want to use multiple partial files, Add your partial files into the _partials folder.
src/_partials
You can call partial files directly by other templates like this example.
{{> _header }}
<main>
<h1>Welcome to VITAM Docs!</h1>
<p>VITAM is a front-end template with Vite for static websites.</p>
</main>
{{> _footer }}
site.config.ts manages the site's basic information. You have to edit site.config.ts when you create a new page.
const pagesData = {
'/sample/index.html': {
locale: siteData.locale,
title: `Smaple Page | ${siteData.siteName}`,
description: `This is a sample page. ${siteData.description}`,
url: `${siteData.url}/sampple/`,
ogpImage: siteData.ogpImage,
ogType: 'article',
fbAppId: siteData.fbAppId,
fbAdmins: siteData.fbAdmins,
twitterCard: siteData.twitterCard,
twitterSite: siteData.twitterSite,
},
};
Sass (Dart Sass)
You can manage style sheets logically with Sass. I've already defined some functions and Mixins.
Check out these files before you get started with your project.
src/scss/foundation/functions/*.scss
src/scss/foundation/mixins/*.scss
CSS Architecture
VITAM gives you CSS architecture which is Enduring CSS standardly, but it's not necessary architecture in all projects. I recommend you introduce the best architecture in each project.
TypeScript
VITAM supports TypeScript. It's easy to import ts files.
You can customize TypeScript's options with tsconfig.json
at any time.
I've already defined some utility functions.
Check out these files before you get started with your project.
src/ts/utils/*.ts
postInstall
command will help you to install typings in this project.
Jest is built-in in this project. You can run Jest from the command line.
π Learn TypeScript
π Learn Jest
PWA
Vite Plugin PWA supports making your website faster.
Edit vite.config.ts
if you would like to customize settings for PWA.
You can generate icons for PWA with Favicon Generator.
Note: Please replace some asset files for PWA with your project's files.
GitHub Actions
If you use GitHub in your project, you can take advantage of GitHub Actions to automate your development workflows.
Check out this file before you get started with your project.
.github/workflows/project-ci.yml
Conclusion
I added some useful libraries and utility functions into VITAM to improve your development efficiency. I hope you take advatage of them.
Top comments (0)