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

Change in referenced file not propagating #221

Open
BastianHofmann opened this issue Jan 30, 2017 · 1 comment
Open

Change in referenced file not propagating #221

BastianHofmann opened this issue Jan 30, 2017 · 1 comment

Comments

@BastianHofmann
Copy link

Let's say I have two files child.html and parent.html and the child.html file is referenced in the parent.html file. Now I run cache bust on those files and they both get renamed to some filenames child.{a}.html and parent.{b}.html (with a and b as the hash values).
If I now change the child.html and run cache bust again, only the child file will get the new filename child.{a'}.html. The parent file will remain with it's old filename parent.{b}.html.

I prepared a small example: https://github.com/BastianHofmann/grunt-cachebust-test (just to npm install and run grunt, you can use the change branch to change the child.html file)

I would expect the filename of the parent to change as well.

When using angular's ng-include feature (see my example). The parent.html file is requested first, which will in turn request child.html. A client who has both files cached will not receive the change in the child.html file, because the parent.html file did not change.

To resolve this issue, the plugin could create a tree structure for the dependencies in the files and cache bust the tree from the leaves to the root. Loops in the tree may occur (a references b and b references a), but could easily be resolved by choosing a random node as the root (cache bust b -> replace filename in a -> cache bust a -> replace filename in b).

@gustafnk
Copy link

I'm seeing the same phenomena, but with JavaScript files instead of HTML files.

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