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

Add support for long-term caching of files with content-hashed filenames #190

Closed
wants to merge 2 commits into from
Closed

Conversation

jjavery
Copy link

@jjavery jjavery commented May 12, 2017

Would this be useful to anyone else?

ETags are great but still require an If-None-Match/304 Not Modified request/response cycle. Tools like webpack are often configured to produce static assets with content-hashed filenames. The filename contains a hash of the file content, so when the content changes, the filename changes. For example, Create React App produces (via webpack) filenames like this: /static/js/main.54d5d5d6.js.

This pull request adds the boolean --hash option which enables detection of content-hashed filenames and serves the files with a max-age of 365 days. It also adds the --regexp option which can be used to change the default RegExp. The default RegExp matches the hash format used by Create React App.

https://webpack.js.org/guides/caching/#components/sidebar/sidebar.jsx

@leo
Copy link
Contributor

leo commented Jun 20, 2017

Thank you for the effort you've put into his! But please consider creating an issue the next time before you start tackling the topic, so that we can discuss it and agree on it. Because in this case, I don't think it's a good idea to merge this into the project, since we're trying to keep the core as small as possible.

@leo leo closed this Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants