Skip to content

A WordPress theme build with StencilJS Web Components

License

Notifications You must be signed in to change notification settings

MadnessLabs/StencilPress

Repository files navigation

StencilPress

StencilPress Logo StencilPress is a WordPress theme starter made with StencilJS web components by the good people at Madness Labs.

Getting Started

To start building a PWA with the Ionic PWA Toolkit, clone this repo to a new directory:

git clone https://github.com/madnesslabs/stencilpress.git theme-name
cd theme-name
git remote rm origin

and run:

npm install
npm start

Production

To build your PWA for production, run:

npm run build

A production build includes everything needed for your project to be a PWA right out of the box. This includes both a Web Manifest (src/manifest.json) and a Service Worker (www/sw.js).

Hosting

For top PWA performance, your app should be hosted with a hosting provider that supports HTTPS and HTTP2 out of the box.

We currently recommend Firebase Hosting, though we are working on Ionic PWA Hosting with even more features.

H2 Push

To ensure the fastest possible load time for your PWA, we recommend setting up H2 push on Firebase. Here is an example of what this looks like in your firebase.json file. Lets go over the steps of how to setup H2 push properly for your Ionic PWA:

** Note: In an upcoming release we will be automatically generating this H2 push config for you meaning you will not have to do any of the above anymore **

Service Workers

For info on how Service Workers work in Stencil check out our Service Worker docs.

Developing with a Service Worker

In some cases, for instance when you are working on adding web push notifications or background sync, both which require a Service Worker, it can be handy to be able to dev builds with a service worker.

To do this with the Ionic PWA toolkit simply run npm run devWithSW. This will start a dev build, but with the Service Worker also getting livereloaded.

Lazy Loading Images

Check out the lazy-img component in src/components/lazy-img/lazy-img.tsx.

Unit Tests

To run the unit tests once, run:

npm test

To run the unit tests and watch for file changes during development, run:

npm run test.watch

Testing your PWA's performance

We recommend using https://www.webpagetest.org/easy with the Run Lighthouse Audit option turned on. This will give you an in depth look into your PWAs load performance on the average device connected to the average network. For more info on how to use webpagetest check out https://zoompf.com/blog/2015/07/the-seo-experts-guide-to-web-performance-using-webpagetest-2.

Why Stencil?

Stencil is a tool we developed at Ionic to make it easy to build Web Components and load them in an efficient manner. Generally, using a classic framework like Angular or React will make building a fast PWA challenging. Stencil provides a similar API to Angular and React but is focused on meeting the performance demands of modern Progressive Web Apps.

About

A WordPress theme build with StencilJS Web Components

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published