Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cache-bundle] Additional Content-Types to cache-bundle.json #284

Closed
t2ym opened this issue Nov 21, 2018 · 0 comments
Closed

[cache-bundle] Additional Content-Types to cache-bundle.json #284

t2ym opened this issue Nov 21, 2018 · 0 comments

Comments

@t2ym
Copy link
Owner

t2ym commented Nov 21, 2018

[cache-bundle] Additional Content-Types to cache-bundle.json

API

  • Cache any content types other than text/html, text/javascript, image/svg+xml
    • Optional headers to include in cache response headers
      • hook.parameters.significantHeaders = { "Header-Name": true }
    • Additional Cacheable Content-Types
      • hook.parameters.cacheableContentTypes = { "text/css": true, "image/png": true, ... }
        • Note: text/html, text/javascript, image/svg+xml must not be included here
    • Callback to Validate Cacheable URL
      • hook.parameters.validateCacheableUrl = function (url, contentType)
        • url: String: target URL to validate
        • contentType: String: normalized Content-Type without charset
        • return a truthy value if url with contentType is cacheable
        • If the callback function is undefined, any contentType values within hook.parameters.cacheableContentTypes are cacheable
  • Extended Metadata Format in cache-bundle.json
  cacheBundle = {
    "version": "version_123", // cache version
    "url?param=1": "body in string", // concise format for string data for .js, .html, .json, .svg; equivalent to { "body": "body in string", "Content-Type": "{type}" }
    "url?param=2": {
      "Location": "url?param=1", // link to the other content
      "Location": "data:image/jpeg;base64,...", // encoded body data; Note: "Location" appears only once in a metadata object, of course
      // If Non-dataURI "Location" exists, other metadata entries are ignored
      "Content-Type": "text/xml", // MIME type
      "body": "body in string", // content body
      "Other-Headers": "header value", // HTTP headers
    },
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant