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

Specify what to hash #28

Closed
opatut opened this issue Mar 10, 2016 · 1 comment
Closed

Specify what to hash #28

opatut opened this issue Mar 10, 2016 · 1 comment

Comments

@opatut
Copy link

opatut commented Mar 10, 2016

(Originally posted at webpack-contrib/file-loader#60)

I'd like to be able to specify what to mangle through the hash function in order to get the [hash]. In my specific case, I want to hash [path][name]. I would like to have an additional parameter in the [hash] brackets that specifies a pattern (to be interpolated with interpolateName) for what to hash.

Rationale: we're building different versions that are served based on the request origin, but using the same js bundle (and server side code!), but with different file contents (e.g. different images at logo.png). If we were to hash the content, the different file had a different hash, and we could not map it from the one the js bundle requested. We don't want to use [path] in production either because it gives away our file structure. Hence we'd like to hash the path.

I also want to to be able to add two different hashes, one using the path, one using file content, to the generated name. We need this for the version suffix to trick the browser cache, i.e. generate [hash:[path]]/[name]-[hash:6].[ext].

@sokra
Copy link
Member

sokra commented Apr 9, 2016

see comment in PR

@sokra sokra closed this as completed Apr 9, 2016
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

No branches or pull requests

2 participants