Based on this tutorial, this project offers a simple project which uses webpack for bundling JS/SCSS/CSS files and minifying them
Webpack allows you to split your JavaScript into separate modules in development (better for maintenance) while letting you compile those modules into a single bundle in production (better for performance).
- Bundle JS modules and scripts to 1 file => better performance (instead of having many requests to the server)
- Include styling files (e.g. SCSS / CSS / assets) into the bundled JS
- Minify JS => better optimization
- Generate HTML file from a template HTML => better to avoid keeping track of dependencies and includes
- Avoid wrong caching by adding a hash to the file name
- Have a server with automatic reload => easier development
Simple quote generator based on https://api.quotable.io/random
sass-loader
/css-loader
/style-loader
: to be bundled inside the JS bundle fileHTMLWebpackPlugin
: to generate output HTML based on a template HTML fileCaching
: adding (contenthash) to filename to avoid caching an outdated fileWebpackDevServer
: to auto-reload the page on changes (for development phase only)Source Maps
: provide a mapping between the original source code and bundled file (useful for debugging)Babel Loader
: for browser backward compatibilityAsset Resource Loader
: for loading images from JSTerserWebpackPlugin
: for JS minificationMiniCssExtractPlugin
: for CSS minification
git clone https://github.com/3omdawy/webpack-quote-generator.git
cd webpack-quote-generator
npm install
npm run dev // in case of development
npm run build // to generate a build