Skip to content

robinhuy/webpack-static-pages-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack Static Pages Template

Optimizing static website with webpack 5

Template features

Run development server in localhost with Hot reload.

Build code for production:

  • Bundle code (multiple pages).
  • Minify HTML + CSS, Minify + Obfuscate JS.
  • Auto inject CSS to end of <head> tag and JS to end of <body> tag.
  • Rename CSS + JS file by hash content to Cache Busting.
  • Compress images.

Install

NPM: npm install

Yarn: yarn install

Run development server

NPM: npm start

Yarn: yarn start

Source code for development inside src folder (can be changed in config).

Build production

NPM: npm run build

Yarn: yarn build

Code built for production inside dist folder (can be changed in config).

Setup

Config entry-points in webpack.common.js.

Default project structure:

Project Structure


Vietnamese tutorial: Tối ưu static page với Webpack