Comments (7)
A placeholder image is an interesting one, but a challenge is making one that scales at all aspect ratios in a way that it doesn't look horrible. Hopefully 404 images should be rare anyway, right?
For the PWA plugin, you can refer to my child theme of Twenty Seventeen to see some integrations: https://github.com/westonruter/twentyseventeen-westonson
In particular:
- Offline page (
offline.php
) and Internal Server Error page (500.php
). See also mentions ofoffline
and500
infunctions.php
, and pick what you need. - Precaching scripts and styles for offline access. The PWA plugin in
develop
has this integration behind a flag. - Customize the Web App Manifest via filter.
- Opt-in to stale-while-revalidate for navigation requests.
Note that WPRig has added support for the offline/500 templates as well: wprig/wprig#212
Beyond these aspects, the rest is really up to the specific site's needs. For instance, adding support for SPA (app shell) via AMP you can refer to this un-merged PR: ampproject/amp-wp#1519
👉 The PWA plugin would value your feedback from integrating. It's overdue for releasing 0.2 on WordPress.org, so any feedback you can give would help in that regard to push out the next release.
from theme-scaffold.
My next thought was to place it at the root of the theme, but this still traps us a bit. Ideally, we need to place the service worker in the root install of a project.
@dainemawer Could you please use the PWA feature plugin for this? It handles this for you.
Aside: We're about to release 0.2 on WordPress.org.
from theme-scaffold.
Write up about a service worker template: https://madebymike.com.au//writing/service-workers/
from theme-scaffold.
Perhaps some integration with PWA plugin (Google, Automattic, XWP) hooks if the plugin is active?
Examples:
wp_register_service_worker()
web_app_manifest()
wp_register_service_worker_caching_route()
wp_service_worker_integrations_enabled()
from theme-scaffold.
Think a simple service worker to potentially provide:
- "Offline" page
- Image placeholder (loads a branded image for the site if the image 404s)
May be a good baseline for inclusion.
from theme-scaffold.
@timwright12 I've added a manifest file and tested. Heres the output of Lighthouse's Audit:
Just waiting on write access to the repo, which I pinged you about in Slack.
I looked into the Service Worker as well. Service Workers are scoped to whatever folder structure they are found in, so for instance, if the Service Worker is placed in dist/js/sw.js
- its scope only applies to the dist
folder. My next thought was to place it at the root of the theme, but this still traps us a bit. Ideally, we need to place the service worker in the root install of a project.
I wasn't sure what would be the best way of handling that. I've seen some suggestions on using symbolic links which we could maybe setup using bash in our build scripts or execute via node / webpack. A further discussion around what we actually want the Service Worker to handle may help us get a better idea of where to place it.
from theme-scaffold.
The PWA plugin v0.2 was released last week: https://wordpress.org/plugins/pwa/
from theme-scaffold.
Related Issues (20)
- Consider Adopting Parcel HOT 5
- Inline global declarations in the config files generate eslint errors. HOT 3
- Avoid transpiling upstream dependencies HOT 1
- Add `@wordpress/scripts` like auto generation of wp script dependencies HOT 3
- Add styling for wide and full alignment
- Change default alignment of the `core/media-text` block to `none`
- Add .env to support things like overriding the proxied url HOT 1
- Remove eslint from webpack. HOT 2
- Update loading for the block CSS file
- Is `TenUpScaffold\ Overrides\setup();` missing on purpose HOT 2
- Update stylelint HOT 2
- Add ARIA Landmarks to Skeleton HTML
- Add Gutenberg Specific CSS Partial
- Implement Asynchronous CSS HOT 8
- editor-style.css path
- node_modules added to eslintignore HOT 3
- Gutenberg block set up structure.
- SVGs are cropped upon deployment HOT 1
- Add Dynamic Import and Code Splitting Support to Webpack
- PHP warning: function 'FbSustainability\Core\js_disabled_stylesheets' not found
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from theme-scaffold.