1 | # hexo-offline
|
2 | [![npm version](https://img.shields.io/npm/v/hexo-offline.svg?style=flat-square)](https://www.npmjs.com/package/hexo-offline)
|
3 | [![Build Status](https://img.shields.io/travis/JLHwung/hexo-offline.svg?style=flat-square)](https://travis-ci.org/JLHwung/hexo-offline)
|
4 | [![AppVeyor build status](https://img.shields.io/appveyor/ci/JLHwung/hexo-offline.svg?style=flat-square)](https://ci.appveyor.com/project/JLHwung/hexo-offline)
|
5 | [![Coverage Status](https://img.shields.io/coveralls/JLHwung/hexo-offline.svg?style=flat-square)](https://coveralls.io/github/JLHwung/hexo-offline)
|
6 | [![Dependencies Status](https://img.shields.io/david/JLHwung/hexo-offline.svg?style=flat-square)](https://david-dm.org/JLHwung/hexo-offline)
|
7 | [![Dev Dependencies Status](https://img.shields.io/david/dev/JLHwung/hexo-offline.svg?style=flat-square)](https://david-dm.org/JLHwung/hexo-offline?type=dev)
|
8 |
|
9 | hexo-offline is intended to provide offline experience for [hexo](https://hexo.io) built static website. It uses *ServiceWorker* under the hood. Simply install this plugin to your website and it should be offline ready by caching most of static assets.
|
10 |
|
11 | ## Install
|
12 | ```bash
|
13 | npm i hexo-offline --save
|
14 | ```
|
15 | Once installed, run `hexo clean && hexo generate` to activate offline experience.
|
16 |
|
17 | ## Usage
|
18 | hexo-offline aims to provide out-of-the-box offline enhancement to your hexo project. Meanwhile it offers full list of options control from [sw-precache](https://github.com/GoogleChrome/sw-precache#options-parameter). Simply add your configuration to the root `_config.yml`.
|
19 |
|
20 | ```yaml
|
21 | # offline config passed to sw-precache
|
22 | offline:
|
23 | maximumFileSizeToCacheInBytes: 5242880
|
24 | staticFileGlobs:
|
25 | - public/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff}
|
26 | stripPrefix: public
|
27 | verbose: true
|
28 | ```
|
29 |
|
30 | ## [Demo](https://jhuang.me)
|