Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-plugin-content-hash

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-plugin-content-hash

Add content hash to requests for app-data.json and page-data.json generated by Gatsby.

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38
increased by192.31%
Maintainers
1
Weekly downloads
 
Created
Source

gatsby-plugin-content-hash

npm version

Add content hash to requests for app-data.json and page-data.json generated by Gatsby. This plugin is probably needed for the Gatsby app to work properly in an environment like GitHub Pages where file cache control is not possible. For details, refer to the issue below.

Why are page-data.json files not content hashed? #15080

This plugin only works on files generated by gats by build.

It works on Gatsby v2, v3 and v4.

Sample repository

gatsby-plugin-content-hash-example

Installation

npm i --save gatsby-plugin-content-hash

Usage

In your gatsby-config.js:

{
  resolve: "gatsby-plugin-content-hash",
  options: { build_root_path: `${__dirname}/public` },
},
optiondefaultdescription
build_root_pathnone, you must specify in your gatsby-config.js. See the usage example above.The directory where the built static files are located.
hashing_target_file_names['app-data.json', 'page-data.json']Resource file names to add the hash.

Is it works?

You will find the following log in the npm run build command.

info [gatsby-plugin-content-hash] modified 27 HTML/JS files.

And the built app will reference the hashed app-data.json and page-data.json.

Network traffic of the built app

Licence

MIT

Keywords

FAQs

Package last updated on 27 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc