An ES201X starter with common frontend tasks using Webpack 4 as module bundler and npm scripts as task runner.
For an older version with Gulp 4, see 1.6.2.
Node ">=6.0.0" (use brew or install it from here)
brew install nodeOSX & Linux:
git clone --depth 1 https://github.com/dmnsgn/frontend-boilerplate.git && cd frontend-boilerplate && rm -rf .git && git initWindows:
git clone --depth 1 https://github.com/dmnsgn/frontend-boilerplate.git && cd frontend-boilerplate && rd /s /q .git && git initnpm installOpen config/config.js:
| Key | Description | Type |
|---|---|---|
| PATHS | map of paths to the differents folders needed by webpack and npm scripts |
Map |
| BROWSERS | the browsers targeted for babel-preset-env and autoprefixer (see full list here) |
Array |
Open package.json:
| Key | Description | Type |
|---|---|---|
| config.title | title used for metas and favicons | String |
| config.url | absolute url used for metas, robotstxt, sitemap and banner | String |
| config.lang | language for index.html and favicons | String |
| config.description | title used for metas, favicons and banner | String |
| config.copyright | license acronym used for banner | String |
| config.handle | twitter handle for metas | String |
| config.analyticsUA | google analytics UA | String |
| author.name | author name used for favicons | String |
| author.url | author url used for favicons | String |
npm run dev
// or npm startnpm run prod
// or npm run buildWebpack loaders
- Babel with preset-env and TypeScript
- PostCSS: see postcss.config.js
- Sass
- Less
- Stylus
- fonts via file-loader
- images via file-loader and optimised with image-webpack-loader
- svg via file-loader and optimised with svgo-loader
- html-loader
- ejs-loader
- glslify
Webpack plugins
- DefinePlugin: create global constants which can be configured at compile time
- HotModuleReplacementPlugin: enable Hot Module Replacement
- HtmlWebpackPlugin with Lodash templates: simplify creation of HTML files
- MiniCssExtractPlugin: lightweight CSS extraction plugin
- SpritesmithPlugin: convert a set of images into a spritesheet and SASS/LESS/Stylus mixins
- BannerPlugin: add a banner to the top of each generated chunk.
- WebpackStatsPlugin: ingest the webpack stats object, process / transform the object and write out to a file for further consumption.
npm run clean: remove all the files from thedistdirectorynpm run favicons: generate favicons files and/src/templates/_favicons.ejsnpm run robotstxt: generate robots.txt filenpm run sitemap: generate sitemap.xml file
Prettier formatter
MIT