A modular front-end boilerplate using the power and simplicity of MVU architecture, Webpack 4 + HMR, and ES6+ via Babel. Includes Webpack's Tree Shaking configuration. Utilizing functional javascript paradigm, BEM and mobile-first responsive approach. It's suitable for scalable applications.
The provided boilerplate is powered by the following technology stack:
- ESLint — modern linter that helps you avoid errors and enforce conventions in your styles.
- StyleLint — reporter for syntax and style issues.
- Babel 7 — transpiler from ES6 to ES5.
-
PostCSS — ecosystem of custom plugins and tools aimed at transforming extended syntaxes and features into modern, browser-friendly CSS.
PostCSS plugins:
build-utils/postcss/postcss.config.js- postcss-import
- postcss-map
- postcss-bem-fix-fdruide'
- postcss-mixins
- postcss-simple-vars
- postcss-nested
- postcss-utilities
- postcss-jsmath
- postcss-calc
- postcss-atroot
- postcss-selector-not
- postcss-extend
- lost
- postcss-preset-env
- postcss-color-function
- postcss-media-fn
- postcss-flexbugs-fixes
- postcss-nano
- postcss-reporter
-
Tachyons — functional CSS library.
- jQuery — javascript library.
- Waypoints — javascript library that makes it easy to execute a function whenever you scroll to an element.
- Ramda — javascript functional library.
- Hyperscript Helpers — terse syntax for hyperscript.
- Virtual DOM — a javascript DOM model supporting element creation, diff computation and patch operations for efficient re-rendering.
- Ejs — embedded JavaScript templates.
git clone https://github.com/wwwsolutions/wwwsolutions-mvu-starter app-name
cd app-name
npm installnpm run devnpm run prodnpm run prod:serveSupport for Node.js > 8
- Update name, description, author, repository in
package.json - Update app title in
build-utils/options/htmlWebpackPluginOptions.js
Assign yourself a unique publicly accessible url that will proxy all requests to your locally running webserver.
npm install -g ngrok
npm run tunnel # run in a new tabYou will receive a url, for example https://439bf560.ngrok.io, that you can share with anyone. Any requests will be routed to your local service at the specified port.
Webpack serves your app in memory when you run npm run dev. No physical files are written. However, the web root is /src, so you can reference files under /src in index.html.
When the app is built using npm run prod, physical files are written to /dist folder and the app is served from /dist with command npm run prod:serve.
npm run prod. This will prepare and build the project for production use. It does the following:
- Minifies all JS and CSS
- Inline base64 URLs for images and fonts if their size is less than specified limit
- Places the resulting built project files into
/distdirectory. (This is the folder you'll expose to the world).
This task takes multiple svg files from
src/assets/iconsand generates single sprite file insrc/assets/sprites/. Also generates a CSS filesrc/styles/postcss/generated/_sprite.cssfrom templategulp/templates/sprite. To use it, addclass="icon .icon--*"into your html.
npm run gulp:iconsA custom build of Modernizr for feature detection. Generates
src/vendors/modernizr.jsfile from options in.browserslistrc. Used in webpack build.
npm run gulp:modernizr
MIT License, 2019.
Brought to you by Domagoj-Mario Mendas
