forked from AOEpeople/Aoe_JsCssTstamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Append timestamp to not merged css and js
Now js and css files will have timestamp appended even if they are not bundled into one file. This change also adds timestamp to files included directly in the template e.g. <script type="text/javascript" src="<?php echo $this->getSkinUrl('js/jquery.js'); ?>"></script>
- Loading branch information
Showing
1 changed file
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tmotyl,
I've added this feature to the latest Aoe_JsCssTstamp version (and bumped it to 0.7.0).
I modified your implementation
Thank you for this implementation. That helped me to save some time :)
Have a great day,
Fabrizio
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice to hear :)
however nowadays most of the time we use https://github.com/GordonLesti/Lesti_Merge with some modifications as it allows to group js by handle.
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the hint. I'll definitely check that out. Lest_Merge's approach to group files by handle seems to be smart :)
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, just by reading his code I can't get how he actually create the different bundles. I can see the module is traversing the layout xml and will "remember" to origin of addJs/* methods by adding a new attribute to the xml.
But then there's no additional code that does something with this new information. Am I missing something?
And does this solve the problem of cache busting (by adding a dynamic portion to the filenames)?
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you use the Magento feature to combine js, then the filename is a hash based on the filenames.
I don't remember right now if it adds the hash when combining is disabled.
We've improved the module, that it calculates the filename hash based on the file content (instead of filenames). And with this modification your're safe :)
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After calling this parent::getSkinUrl(), the CSS and Js files are with timestamp. But when I open them they are showing not found. Can someone help in this?
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@priyanka-saini make sure your webserver apache/nginx is configured correctly
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now I am using Filesystem not database. As per the documentation I should not do any thing in nginx
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even if not using database you still need rewrite rule like
RewriteRule (.*)\.(\d{10})\.(gif|png|jpg)$ $1.$3 [L,NC]
5471779
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I do not use it for images