Ollie-UI is a culmination of several years of self-taught front-end development and 100's of hours of JavaScript, Web Development, DevOps courses and tutorials merged into a starter-kit that I've used for 5+ in-production projects.
With so many decisions a front-end developer has to make I figured I'd stop being inconstant, forgetting this setup item or that, on various projects and combine it all together into something that scaffolds almost any new project I work on.
It's some dependency-heavy scaffolding on top of Express.js to provide a quick, easy mock API to prototype against.
// ...
const port = 3000
// ...
app.get('/', function mainHandler(req, res) {
res.sendFile(path.join(__dirname, '../src/index.ejs'))
})
// ...
app.listen(port, function(err) {
if (err) {
console.log(err) // eslint-disable-line no-console
// Rollbar.com Error Tracking, uncomment to enable
// rollbar.critical("Critical Error Caught: ", err)
} else {
open('http://localhost:' + port)
}
})
Some of the things out of the box are,
- Webpack Development / Production — Separate dev and prod configs & builds. Local development means fast builds via the in-memory webpack-dev-server, and for production builds every possible optimization needs to be utilized, making for slower builds at the gain of better optimizations.
- Hot Module Replacement — as changes are made to JavaScript, CSS, or templates, the webpage seamlessly refreshes.
- Dynamic Code Splitting — Webpack sorts out how to chunk JavaScript in a config file, auto-magically.
- Async Dynamic Module Loading - Load only the code/resources needed, when they are needed, without render blocking.
- Modern to Legacy JS Bundles — Deploy modern ES2019+ JavaScript modules while gracefully providing a fallback legacy bundle for legacy browsers (with all of the transpiled code and polyfills).
- Cache Busting via manifest.json - Sets long expiry data for our static assets, while also ensuring that they are automatically cache busted if they change.
- Critical CSS — This is something that makes initial page loads significantly faster by only delivering the styles needed first.
- Workbox Service Worker — Leverage Google’s Workbox project to generate a Service Worker for us that will know about all of our project’s assets.
- PostCSS — The “Babel of CSS”, lets you SASS like a boss.
- Image Optimization — Optimize them via automated tools like mozjpeg, optipng, svgo, etc for next step...
- Automatic .webp Creation — Chrome, Edge, and Firefox all are supporting .webp, and can signifigantly boost performance.
HTTP & API
Ollie uses a Express, with a centralized API approach which configures all calls, handles pre-loader logic and also errors.