Prerequisites: Node 14 or 15
Please make sure to use Node 14 or 15 before starting the setup process.
- run
npm i
to install dependencies - run
npm start
to start a local development server
-
Website Info
- open
gulpfile.mjs
and updateconfig = {...}
object with your new website info (siteName, siteURL, androidColor, cacheId...)
- open
-
Icons + Manifest
- place a copy of your logo (should be in SVG + named
logo.svg
) inside theconfig
folder - run
npm run favicon
to generate all icons/favicon/manifest/...
- place a copy of your logo (should be in SVG + named
-
Fonts
- change
config/font.json
to specify which fonts you want to use from Google Fonts- specify any font family (Roboto...) & styles (400,300italic...) in json file
- specify a web safe font as a fallback for each custom font. Customize fallback font properties to minimize CLS using this tool: https://meowni.ca/font-style-matcher/
- run
npm run font
to automatically download/generate all fonts extensions/styles...
- change
- run
npm run image
to minify/resize images
note: run this only once, but you have to rerun it if you add any new images to theimg
folder - run
npm run build
to build for production - run
npm run netlify
ornpm run firebase
to deploy to your provider of choice (or just push to Github if you are using Cloudflare Pages / Netlify CD)
-
You should wrap every
img
tag with apicture
tag. Also you should usedata-src
instead of the normalsrc
attribute to lazy load imagesExample:
<picture> <img data-src="./img/example.png" alt="example" height="50" width="50" /> </picture>
note: All images are lazy loaded by default, but you can customize this in
util/shared.js
-
Faster Build Tip
- To avoid long build times in CI when deploying for example to
Netlify
commit yourdist/img
folder to your Github repo so you don't have to run thenpm run image
command on every deploy.
- To avoid long build times in CI when deploying for example to
Sometimes npm i
fails, this has nothing to do with the TurboKit script.
It's an issue related to the image processing library sharp
.
To fix this issue simply set the following environment variables in your CD/CI config (netlify, cloudflare pages...)
NODE_VERSION: 14.17.5
PYTHON_VERSION: 3.7
use nvm
to switch to node version 14
or 15
and then run npm install.
Note: using node 16
or 17
or later might make sharp
installation fail and then thus stop the npm i
task
npm start
- start local development server
-
npm run favicon
- generates PWA favicons, manifests and injects them into HTML files
-
npm run font
- downloads fonts from 'Google Font' as specified in
config/fonts.json
- injects them into
shared/css/shared.css
- downloads fonts from 'Google Font' as specified in
-
npm run image
- This script should be run only if you have added new images to your
src/img
folder. All the images that the script generates will go toimg
folder
- This script should be run only if you have added new images to your
-
npm run build
- minify, bundle and build for production files will output everything to
dist
folder. checkbuild
task ingulpfile.mjs
to understand everything that this command does. (you should run it before every deploy)
- minify, bundle and build for production files will output everything to
-
npm run full
- run a full build: will run both commands
npm run image
and 'npm run build'
- run a full build: will run both commands
-
npm run netlify
- deploy website to netlify (this is manual deployment. Of course, you can use netlify auto deploy on Github push)
-
npm run firebase
- deploy website to firebase
-
npm run format
- format all
src
folder files
- format all
-
npm run test
- run a local lighthouse test of the
dist
folder
- run a local lighthouse test of the
-
npm run test-live
- run a lighthouse test of a live website in production (change
siteUrl
property ingulpfile.mjs
config object before running this )
- run a lighthouse test of a live website in production (change
-
npm run update
- update all
package.json
dependencies and install them
- update all
├── config # fonts/favicon/eslint/prettier... configuration files
├── dist # all build production files
├── img # all production images generated by `npm run image`
├── src # all source files
│ ├── audio # all your audio files
│ ├── font # generated fonts by `npm run font` command
│ ├── img # all your source images
│ ├── json # all your source json (lottie files...)
│ ├── meta # all icons + web manifest
│ ├── pages # all your website pages (html,css,js)
│ │ ├── css # all libraires CSS files
│ │ └── js # all libraires JS files
│ ├── util # utility files shared between all pages
│ │ ├── shared.css # shared CSS file
│ │ └── shared.js # shared JS file
│ ├── video # all video files
├── .prettierrc # Configure prettier formatting rules
├── netlify.toml # Configure netlify hosting
├── firebase.json # Configure firebase hosting
└── ...