-
Notifications
You must be signed in to change notification settings - Fork 555
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
Preventing Assetic from rewriting each time #433
Comments
CacheBustingWorker is not about preventing running assetic filters. It is about changing the generated name when the content changes, to bust the browser cache (thus allowing to use cache headers far in the future) |
thank you. So I should write my own method about testing if file contents have changed before sending the assets to the writer? Can the method that generates the file name be called separately from writing the file so I can still pass it? |
@Zxurian the check if it has changed would be comparing |
@stof just a gut feeling, but at least for the "deep" mtime that would still apply filters, not? And you have to use the LazyAssetManager, the simple one does not provide that method. |
@mpdude I can verify that calling ->getLastModified() doesn't apply the filters, just returns the most recent last modified date of files in the collection. Thanks for the heads up. I've modified my code accordingly, however the names being generated aren't unique to the collection. (getting names via $Asset->getTargetPath()) How can I make the names unique to the content that's in them? (original post updated with new code) |
I take it back @mpdude , I went through the source, and using the CacheBustingWorker for content does in fact base it off the ->dump() method, which is post-filter, I thought it was based on pre-filtered content, so I've switched to modification time. Last problem is that it's not generating new asset names based on the input file names/paths. I'm substituting my own renaming funciton for the time being, but I was under the impression that the name generated was supposed to be unique based on the input assets. |
Are you using 1.0 or the 1.1 branch? |
I've been pulling from the master branch, but haven't updated in a while. |
So i'm using the following code to setup workers with collections, and then write them to a publically accessible drectory, then passing the resulting file to my view controller so that the files can be included in the head of my templates.
The problem is that it's running the assets through the filters every time, not just on changes (which is what I understood the CacheBustingWorker was supposed to prevent).
I'm running on the theory that I'm doing something wrong, but can't figure out where I'm going astray.
Is there a method I can run to to check if there's changes on the assets to see if there's any changes? and if none, just returns the resulting file names instead of rewriting them each time?
The text was updated successfully, but these errors were encountered: