Skip to content

Commit

Permalink
Remove comments from undesired location and change option name
Browse files Browse the repository at this point in the history
  • Loading branch information
hariombalhara committed Jun 20, 2021
1 parent 86c109e commit c28a824
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion documentation/docs/05-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ import { build, files, timestamp } from '$service-worker';
```

- `build` is an array of URL strings representing the files generated by Vite, suitable for caching with `cache.addAll(build)`
- `files` is an array of URL strings representing the files in your `static` directory, or whatever directory is specified by [`config.kit.files.assets`](#configuration). You can exclude certain files from `static` directory using [`config.kit.serviceWorker.filesExclusions`](#configuration)
- `files` is an array of URL strings representing the files in your `static` directory, or whatever directory is specified by [`config.kit.files.assets`](#configuration). You can exclude certain files from `static` directory using [`config.kit.serviceWorker.exclude`](#configuration)
- `timestamp` is the result of calling `Date.now()` at build time. It's useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches
4 changes: 2 additions & 2 deletions documentation/docs/14-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const config = {
template: 'src/app.html'
},
serviceWorker: {
filesExclusions: []
exclude: []
},
floc: false,
host: null,
Expand Down Expand Up @@ -83,7 +83,7 @@ An object containing zero or more of the following `string` values:

An object containing zero or more of the following values:

- `filesExclusions` - an array of glob patterns relative to `files.assets` dir. Files matching any of these would not be available in `$service-worker.files` e.g. if `files.assets` has value `static` then ['og-tags-images/**/*'] would match all files under `static/og-tags-images` dir.
- `exclude` - an array of glob patterns relative to `files.assets` dir. Files matching any of these would not be available in `$service-worker.files` e.g. if `files.assets` has value `static` then ['og-tags-images/**/*'] would match all files under `static/og-tags-images` dir.

### floc

Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/core/create_manifest_data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ export default function create_manifest_data({ config, output, cwd = process.cwd
/**
* @type {string[]}
*/
let exclusions = config.kit.serviceWorker.exclude || [];
const exclusions = config.kit.serviceWorker.exclude || [];

// .DS_STORE files are automatically removed to keep the compatiblity
exclusions = [...exclusions, '**/.DS_STORE'];
exclusions.push('**/.DS_STORE');

/**
* @type {string[]}
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ export type Config = {
hostHeader?: string;
hydrate?: boolean;
serviceWorker?: {
// Glob patterns relative to `files.assets` dir. Files matching this would not be available in $service-worker.files
// e.g. if `files.assets` has value `static` then ['og-tags-images/**/*'] would match all files under `static/og-tags-images` dir.
// As og-tags-images are never loaded by a normal client(browser), they can be comfortably skipped from here.
exclude?: string[];
};
package?: {
Expand Down

0 comments on commit c28a824

Please sign in to comment.