FOE EWNI Frontend Core 🌍
This repo contains the build for all the frontend core elements, the repo is split in different "bundles" and compiled through Webpack4. Refer to the Bundles section below
How to build
yarn install then
yarn run build
yarn start launches a Webpack dev server instance with HMR (hot module replacement), the dev server runs on
http://localhost:9000, livereload listens to port 9001.
Bundles below are for generic use, these are mostly tuned for Drupal 8 sites (main and satellites), for more granularity please import the single components on your builder.
This is the most important CSS and JS bundle to deliver to the browser as soon as possible.
Embed normally as such:
Contains reset and typography, async fonts, bootstrap grid and utilities as well as hero and menu components. This bundle priorotises over-the-fold components and most layout sizing to prevent FOUC (flash of unstyled content) as much as possible. The critical bundle is tuned specifically for our main Drupal sites.
This is the generic bundle, this contains all other components such as forms, inputs, paragraphs, sidebars, campaign menus, etc.
Embed with deferred/preload strategy as such:
The Fonts bundle contains a preloader for the google fonts as well as Font Awesome fonts.
Ultimately the Extras bundle contains all other remaining components which are not in any way required from anonymous visitors, this bundle will append any style needed only from logged-in admins Load as last, use server-side logic to detect logged in users.
How to include in a project
Import the desired bundle from the NPM build itself, eg:
import '@foeewni/web-core/src/XXX' where XXX is one of the bundles above, or import as es6, eg:
import critical from '@foeewni/web-core'
For SCSS you can either import the compiled CSS from the
dist folder (nb: you wont access the SCSS vars in this way)
Or import the actual entry files for the source SCSS, take note the global variables are all stored inside the core bundle.
Components, Drupal and Bootstrap bundles are all dependant from the core.
npm version [major|minor|patch] to bump the semantic versioning details within our package.json and push a commit via the usual PR/code review route (i.e. PR to
develop branch, then PR to
master.). Check release here https://www.npmjs.com/package/@foeewni/web-core