How weareathlon/frontend-webpack-boilerplate works
Project type and purpose
• This is a front-end Webpack 5 boilerplate template designed to jumpstart new web projects. It provides a configurable asset pipeline (JS, SASS/PostCSS, images, fonts, videos, HTML), linting, development server, production build optimizations, and CI/CD via GitHub Actions.
File structure
• Top-level config files: .babelrc, .eslintrc, .sasslintrc, postcss.config.js, webpack.config.js, configuration/*.js
• Source assets under src/:
• src/js/*.js
• src/scss/ (base, demo, dirty hacks)
• src/images/content & src/images/design
• src/fonts, src/videos, src/index.html
• Builds output at /dist (CSS, JS, images, fonts, HTML) controlled by configuration/webpack.{dev,prod}.config.js
• CI and repository management under .github/ (actions pipelines, issue/Pull templates)
• Package metadata and scripts in package.json
README insights
• The README confirms features: environment-specific Webpack configs, Babel, Autoprefixer, imagemin, code linters, Webpack Dev Server, Bundle Analyzer, and GitHub Actions for build+deploy. It outlines development and production workflows.
a. Main components
• Developer workstation (source code editor, terminal)
• Source code repository (GitHub)
• Build/configuration layer:
• Webpack core
• Environment module (configuration/environment.js)
• Dev config vs. Prod config
• Loaders: Babel (JS), Sass/PostCSS, file-loader/url-loader for images/fonts/videos, html-webpack-plugin
• Plugins: Terser, imagemin, autoprefixer, webpack-dev-server, bundle-analyzer
• Linters: ESLint, SassLint
• Development server (webpack-dev-server + live reload)
• Artifact output (dist/)
• Client browser (loads dev server or built assets)
• CI/CD pipeline (GitHub Actions → lint → build → deploy to GitHub Pages)
• NPM registry (optional for publishing @weareathlon/frontend-webpack-boilerplate)
b. Relationships and interactions
• Developer pushes code to GitHub
• GitHub Actions triggers lint → build → deploy
• Local development: Webpack reads environment config & webpack.dev.config → processes src/ assets through loaders/plugins → serves on webpack-dev-server → browser auto-reloads
• Production build: Webpack uses prod config → emits optimized assets to /dist → deployable to static host
c. Architectural patterns/design principles
• Modular pipeline: clear separation of loader chains per asset type
• Environment-driven configuration: abstracted env vars, dev vs. prod
• Convention-over-configuration: auto‐discover all HTML in src/
• GitOps: CI/CD declaratively in .github/workflows
d. Technologies/frameworks/libraries
• Webpack 5, Babel 7, Sass/PostCSS, Autoprefixer, Terser, imagemin, webpack-dev-server, ESLint (Airbnb), SassLint, GitHub Actions
Detail without overthinking
• Separate development vs. production paths.
• Thresholds (e.g., inline assets below size limit).
• How browserslist influences Babel & Autoprefixer.