A basic HTML, Sass, and Javascript template bundled using Webpack.
// Install dependencies
npm install
// Run live server
npm run dev
// Build optimized output
npm run build
- Create a new folder in
src/pages/
- Create
index.html
andindex.js
- Add the folder in
webpack.common.js
// ...
const pages = ['home', 'new-page'];
// ...
- Open
generateHtmlPages.js
insrc/utils
- Add your code inside
font
// ...
function createPage(title) {
return new HtmlWebpackPlugin({
// ...
templateParameters: {
// ...
font: `
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;700&display=swap" rel="stylesheet">
`,
},
});
}
// ...
- Add
<%= font %>
inside your file's<head>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Home</title>
<%= font %>
</head>