This WordPress plugin provides a method for caching theme assets via a service worker.
Перейти к файлу
David Walsh e206e7e838 Merge pull request #47 from darkwing/db-defaults
Organize option defaults
2016-03-04 10:27:03 -06:00
bin Make installer executable 2016-02-23 13:19:35 -06:00
tests Fix 2016-03-03 09:37:11 -06:00
wp-sw-cache Organize option defaults 2016-03-03 16:31:50 -06:00
.gitignore Adding compatibility with WP SW Manager 2016-02-18 18:13:02 +01:00
.travis.yml Adding test uilities 2016-02-23 12:30:38 -06:00
LICENSE Adding paperwork for 0.1.0 2016-02-23 11:33:25 -06:00
Makefile Adding test uilities 2016-02-23 12:30:38 -06:00
README.md Fix duplicate README content - again 2016-02-23 13:33:53 -06:00
karma.conf Add SW tests for 0.1.0 2016-03-02 19:54:40 -06:00
package.json Tagging as 0.2.0 2016-02-23 15:52:34 -06:00
phpunit.xml.dist Adding test uilities 2016-02-23 12:30:38 -06:00
readme.txt Adding readme.txt for WordPress's plugin directory 2016-03-02 12:45:19 -06:00
sw-tests.js Adding more efficient caching mechanism so entire caches aren't deleted for one file change 2016-03-02 12:06:24 -06:00

README.md

Build Status

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:

  1. Activate the plugin
  2. Navigate to the plugin's settings page
  3. Choose assets from the listing that are used most frequently (style.css is likely used on every page of the blog, for example)
  4. 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.