A minimal webpack boilerplate using Babel, PostCSS, Sass and PUG.JS with a small example, grid system and many other Features.
Clone this repo.
git clone https://github.com/aminejafur/webpack-boilerplate.git
Move to folder.
cd webpack-boilerplate
Run npm or yarn install.
npm i
npm run dev
The development server will start at localhost:9000
and a new tab will open in your default browser.
npm run watch
npm run build
- webpack
- Babel
- Pug.js
- Sass
- PostCSS
- Autoprefixer
- BEM naming methodology
- Theme builder mixin demo at '/css/parts/inc/mixins.scss'
// main.scss
// theme_builder(themeName, themeMap)
- Auto template files discovery.
// webpack.config.js
/*
* A function to get all pug or html files with their local path
* NB : any file with .ignore.{ext} will be ignored
* dir : The path from where the templates files should be collected
*/
var getTemplates = function (dir) {...
-
Hot reload or HMR exchanges, adds, or removes modules while an application is running, without a full reload. preview
-
Optimize your site or application using Lazy, or "on demand", loading. preview
-
Loading and renaming assets from css, js, pug and html files. preview
-
Sass global import.
-
Work separately and get a fully optimized template.
ββββcss
β β main.scss
β β style.css
β ββββparts
β β custom.scss
β β footer.scss
β β header.scss
β ββββinc
β extends.scss
β functions.scss
β mixins.scss
β responsive.scss
ββββhtml
β β index.pug
β β just_html.html
β β more.pug
β β
β ββββcontact
β β index.pug
β ββββincludes
β footer.ignore.pug
β grid.ignore.pug
β header.ignore.pug
β layout.ignore.pug
β mixins.ignore.pug
β nav.ignore.pug
ββββimg
β 300.jpg
β 600x200.png
β background.gif
β contact.svg
ββββjs
β plugin.js
ββββloads
noLazyLoad.js
withLazyLoad.js
β app.js
β index.html
β just_html.html
β lazyloadedalert.app.js
β more.html
β style.css
ββββassets
β ββββgif
β β 4962dd623928824097dba370cc1361a1.gif
β ββββimages
β β e206a6d4a58ed35f9ce520d680d4556e.png
β ββββsvg
β 42407f3f7c1291113cb887d93f115840.svg
ββββcontact
index.html
"webpack": "^4.42.1"
"webpack-cli": "^3.3.11"
"webpack-dev-server": "^3.11.0"
"@babel/core": "^7.12.3"
"@babel/preset-env": "^7.12.1"
"babel-loader": "^8.1.0"
"css-loader": "^5.0.0"
"file-loader": "^6.2.0"
"html-loader": "^1.3.2"
"import-glob-loader": "^1.1.0"
"postcss-loader": "^4.0.4"
"pug-html-loader": "^1.1.5"
"sass-loader": "^10.0.4"
"html-webpack-plugin": "^4.5.0",
"mini-css-extract-plugin": "^1.2.1"
"uglifyjs-webpack-plugin": "^2.2.0"
"autoprefixer": "^10.0.1"
- Add ESlint.
- GIF, SVG : Freepik