88ab8d34c8 | ||
---|---|---|
bin | ||
tests | ||
wp-sw-cache | ||
.gitignore | ||
.travis.yml | ||
LICENSE | ||
Makefile | ||
README.md | ||
karma.conf | ||
package.json | ||
phpunit.xml.dist | ||
sw-tests.js |
README.md
WordPress Service Worker Cache
A WordPress plugin for caching theme assets via a service worker for the sake of performance and offline functionality.
This plugin is currently experimental and should only be used with developers with Service Worker knowledge.
Build
To build the plugin, ensure you have Composer,
then simply invoke composer install
.
Installation and Usage
Assuming the build step completed successfully, place the wp-sw-cache
directory inside your WordPress instance's wp-content/plugins directory
.
With the plugin in the WordPress directory structure:
- Activate the plugin
- Navigate to the plugin's settings page
- Choose assets from the listing that are used most frequently (
style.css
is likely used on every page of the blog, for example) - Save!
A service worker will then be placed within every page of the blog and select assets will be served from the service worker!
Install the plugin
Clone the repository and copy the folder wp-offline-content
inside your WordPress plugins
directory.
Activate the plugin from the Plugins menu in the Dashboard. Options are available to customize under the Offline content submenu in Settings.
Running tests
Install dependencies:
./bin/install-wp-tests.sh MYSQL_DATABASE_NAME MYSQL_USER MYSQL_PASSWORD localhost latest
Run tests:
make test
Run service worker tests:
make test-sw
Contribution and Bugs
Contributions are welcome! You can file pull requests or or issues at this repository.
Related WordPress Plugins
- wp-offline-content - Save pages for offline reading
- wp-sw-manager - Shared service worker plugin
- wp-web-push - Add push notifications to your WordPress site!