{"id":16695144,"url":"https://github.com/uiolee/hexo-workbox-build","last_synced_at":"2025-07-25T20:06:21.423Z","repository":{"id":181181278,"uuid":"666284856","full_name":"uiolee/hexo-workbox-build","owner":"uiolee","description":"A hexo plugin to run workbox build. Add PWA support for your site.","archived":false,"fork":false,"pushed_at":"2025-03-10T05:01:03.000Z","size":763,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T03:23:56.880Z","etag":null,"topics":["hexo","hexo-plugin","offline","plugin","pwa","workbox"],"latest_commit_sha":null,"homepage":"https://npmjs.com/hexo-workbox-build","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uiolee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-14T06:25:42.000Z","updated_at":"2024-09-29T16:16:12.000Z","dependencies_parsed_at":"2023-10-17T01:37:00.815Z","dependency_job_id":"580ede5d-326a-4768-bd95-09364f03667c","html_url":"https://github.com/uiolee/hexo-workbox-build","commit_stats":null,"previous_names":["uiolee/hexo-workbox-build"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiolee%2Fhexo-workbox-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiolee%2Fhexo-workbox-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiolee%2Fhexo-workbox-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiolee%2Fhexo-workbox-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uiolee","download_url":"https://codeload.github.com/uiolee/hexo-workbox-build/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142335,"owners_count":21054622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hexo","hexo-plugin","offline","plugin","pwa","workbox"],"created_at":"2024-10-12T17:05:37.642Z","updated_at":"2025-04-10T01:43:16.951Z","avatar_url":"https://github.com/uiolee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hexo-workbox-build\n\n[![GitHub Tag](https://img.shields.io/github/v/tag/uiolee/hexo-workbox-build?logo=github)](https://github.com/uiolee/hexo-workbox-build/tags)\n[![GitHub Release](https://img.shields.io/github/v/release/uiolee/hexo-workbox-build?logo=github)](https://github.com/uiolee/hexo-workbox-build/releases)\n[![GitHub commits since latest release](https://img.shields.io/github/commits-since/uiolee/hexo-workbox-build/latest?include_prereleases\u0026sort=semver\u0026logo=github)](https://github.com/uiolee/hexo-workbox-build/compare/...main)\n[![GitHub top language](https://img.shields.io/github/languages/top/uiolee/hexo-workbox-build?logo=github)](#hexo-workbox-build)\n[![Coverage Status](https://coveralls.io/repos/github/uiolee/hexo-workbox-build/badge.svg?branch=main)](https://coveralls.io/github/uiolee/hexo-workbox-build?branch=main)\n[![CI](https://github.com/uiolee/hexo-workbox-build/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/uiolee/hexo-workbox-build/actions/workflows/ci.yml)\n[![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/uiolee/hexo-workbox-build?logo=librariesdotio)](https://libraries.io/github/uiolee/hexo-workbox-build#dependencies)\n\nA hexo plugin to run [workbox-build](https://www.npmjs.com/package/workbox-build) and provide convenient features of PWA and service worker.\n\n## Feature\n\n- run [workbox-build](https://www.npmjs.com/package/workbox-build) via passing through your custom options. ([generateSW mode](https://developer.chrome.com/docs/workbox/modules/workbox-build#generatesw_mode) or [injectManifest mode](https://developer.chrome.com/docs/workbox/modules/workbox-build#injectmanifest_mode))\n- generate the script which using to register service-worker.\n- reference the register script into html.\n- copy `manifest.json` from custom path to `public\\`.\n- reference the `manifest.json` via `\u003clink\u003e` tag in html.\n\nThis plugin doesn't provide PWA support ready out of the box.\n\nYou need to know how to use [workbox-build](https://www.npmjs.com/package/workbox-build), configurate workbox strategy and custom your `manifest.json`.\n\n## Install\n\n[![NPM Version](https://img.shields.io/npm/v/hexo-workbox-build?logo=npm)](https://www.npmjs.com/package/hexo-workbox-build)\n[![node-lts](https://img.shields.io/node/v-lts/hexo-workbox-build?logo=nodedotjs)](https://nodejs.org/)\n[![NPM License](https://img.shields.io/npm/l/hexo-workbox-build)](./LICENSE)\n[![NPM Downloads](https://img.shields.io/npm/dm/hexo-workbox-build?logo=npm)](#hexo-workbox-build)\n[![NPM Downloads](https://img.shields.io/npm/dt/hexo-workbox-build?logo=npm)](#hexo-workbox-build)\n[![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/hexo-workbox-build?logo=librariesdotio)](https://libraries.io/npm/hexo-workbox-build/tree)\n\n```bash\npnpm add hexo-workbox-build\n\n# npm i hexo-workbox-build\n```\n\n## Configuration\n\n### Default Configuration\n\n```yml\nhexo_workbox_build:\n  enable: false\n\n  WB_runWorkboxBuild: true\n  WB_swDest: \"\"\n  WB_generateSWOptionsPath: \"\"\n  WB_injectManifestOptionsPath: \"\"\n\n  REG_generateRegister: true\n  REG_registerScriptDest: \"registerSW.js\"\n  # REG_registerScriptNjkPath: \"\" # default to internal nunjucks template\n\n  REG_injector: true\n  REG_injectorNjkString: '\u003cscript defer src=\"{{ REG_registerScriptDest }}\"\u003e\u003c/script\u003e'\n\n  MF_copyManifestJsonSrc: \"\"\n  MF_copyManifestJsonDest: \"\"\n\n  MF_injector: false\n  MF_injectorNjkString: '\u003clink rel=\"manifest\" href=\"{{ MF_cpoyManifestJsonDest }}\" /\u003e'\n```\n\n### Example Configuration\n\n```yml\nhexo_workbox_build:\n  enable: true\n\n  WB_runWorkboxBuild: true\n  WB_swDest: \"sw.js\"\n  WB_generateSWOptionsPath: \"workbox/genSWOption.js\"\n  # WB_injectManifestOptionsPath: \"workbox/injMfOption.js\"\n\n  REG_generateRegister: true\n  # REG_registerScriptDest: 'registerSW.js'\n  # REG_registerScriptNjkPath: \"\" # default to internal nunjucks template\n\n  REG_injector: true\n  # REG_injectorNjkString: '\u003cscript defer src=\"{{ REG_registerScriptDest }}\"\u003e\u003c/script\u003e'\n\n  MF_copyManifestJsonSrc: \"workbox/manifest.json\"\n  MF_copyManifestJsonDest: \"manifest.json\"\n\n  MF_injector: false\n  # MF_injectorNjkString: '\u003clink rel=\"manifest\" href=\"{{ MF_cpoyManifestJsonDest }}\" /\u003e'\n```\n\n---\n\n## Options\n\n### enable or disable this plugin\n\n| option name | value type | default value | note                                                                                             |\n| ----------- | ---------- | ------------- | ------------------------------------------------------------------------------------------------ |\n| `enbale`    | boolean    | `false`       | Control whether to enable [`hexo-workbox-build`](https://github.com/uiolee/hexo-workbox-build/). |\n\n---\n\n### ralated to workbox-build\n\n| option name                    | value type | default value | note                                                                                                                                                                                                                                                                                                                                                       |\n| ------------------------------ | ---------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `WB_runWorkboxBuild`           | boolean    | `true`        | Control whether to run [`worlbox-build`](https://developer.chrome.com/docs/workbox/modules/workbox-build/).                                                                                                                                                                                                                                                |\n| `WB_swDest`                    | string     | \"\"            | Specify the name and path of `service-worker` that `worlbox-build` generated. (relative to `public` dir). \u003cbr\u003e\u003cbr\u003e**equal to the [`swDest`](https://developer.chrome.com/docs/workbox/modules/workbox-build#properties_10) option in `worlbox-build`.**                                                                                                    |\n| `WB_generateSWOptionsPath`     | string     | \"\"            | Need `WB_swDest` setting.\u003cbr\u003eSpecify the path of a js file. (relative to your hexo dir), which use default exports the arguments of [`generatesw-mode`](https://developer.chrome.com/docs/workbox/modules/workbox-build/#generatesw-mode) of [`worlbox-build`](https://developer.chrome.com/docs/workbox/modules/workbox-build/).                          |\n| `WB_injectManifestOptionsPath` | string     | \"\"            | Need `WB_swDest` `generatesw-mode` setting.\u003cbr\u003eSpecify the path of a js file. (relative to your hexo dir), which use default exports the arguments of [`injectmanifest-mode`](https://developer.chrome.com/docs/workbox/modules/workbox-build/#injectmanifest-mode) of [`worlbox-build`](https://developer.chrome.com/docs/workbox/modules/workbox-build/) |\n\n\u003e Note: `injectmanifest-mode` depend on a built `sw.js`.\n\u003e\n\u003e It means you need to run `generatesw-mode` first in [`hexo-workbox-build`](https://github.com/uiolee/hexo-workbox-build/).\n\n---\n\n### ralated to register service worker\n\n#### generate the code of registering service-worker\n\n| option name                 | value type | default value   | note                                                                                                                                                         |\n| --------------------------- | ---------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `REG_generateRegister`      | boolean    | `true`          | Control whether to generater a javascript, which is use to register `service-worker`.                                                                        |\n| `REG_registerScriptDest`    | string     | `registerSW.js` | Need `WB_swDest`.\u003cbr\u003eSpecify the path of the above javascript code generated. (relative to `public` dir)                                                     |\n| `REG_registerScriptNjkPath` | string     | \"\"              | path of a nunjucks template of the javascript. (relative to your hexo dir)\u003cbr\u003eDefault template: [`./assets/registerScript.njk`](./assets/registerScript.njk) |\n\n#### insert the registering code into html\n\n| option name             | value type | default value                                                | note                                                                                                                            |\n| ----------------------- | ---------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |\n| `REG_injector`          | boolean    | `true`                                                       | Control whether to Inject the above javascript code into html `\u003cscript\u003e`. \u003cbr\u003eYou can use `REG_injectorNjkString` to custom it. |\n| `REG_injectorNjkString` | string     | `\u003cscript defer src=\"{{ REG_registerScriptDest }}\"\u003e\u003c/script\u003e` | Custom the `\u003cscripts\u003e` string.                                                                                                  |\n\n---\n\n### related to `manifest.json`\n\n#### copy your `manifest.json` into `public`\n\n\u003e If set both `MF_copyManifestJsonSrc` and `MF_copyManifestJsonDest`, [`hexo-workbox-build`](https://github.com/uiolee/hexo-workbox-build/) will copy your `manifest.json` to `public` dir.\n\n\u003e In fact, you can simply put your `manifest.json` in `source/` dir without using this above feature.\n\n| option name               | value type | default value | note                                                                         |\n| ------------------------- | ---------- | ------------- | ---------------------------------------------------------------------------- |\n| `MF_copyManifestJsonSrc`  | string     | \"\"            | Specify the path of your `manifest.json`. (relative to your hexo dir)        |\n| `MF_copyManifestJsonDest` | string     | \"\"            | Specify the destiny path of your `manifest.json`. (relative to `public` dir) |\n\n#### insert a `\u003clink\u003e` ref to your `manifest.json`\n\n\u003e some themes likes next have the same feature, you may not to use this if you enable this feature in themes.\n\n| option name            | value type | default value                                                  | note                                                                                                                                                    |\n| ---------------------- | ---------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `MF_injector`          | boolean    | `false`                                                        | need `MF_copyManifestJsonDest`.\u003cbr\u003econtrol whether to Inject `\u003clink\u003e` tag into head of html.\u003cbr\u003eYou can use `MF_injectorNjkString` option to custom it. |\n| `MF_injectorNjkString` | string     | `\u003clink rel=\"manifest\" href=\"{{ MF_cpoyManifestJsonDest }}\" /\u003e` | custom the `\u003clink\u003e` string.                                                                                                                             |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuiolee%2Fhexo-workbox-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuiolee%2Fhexo-workbox-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuiolee%2Fhexo-workbox-build/lists"}