-
Notifications
You must be signed in to change notification settings - Fork 9
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
<head> elements reordering #45
Comments
I should note that those script and stylesheet elements are hardcoded in the HTML template. I just tested loading Modernizr via The inline Typekit script can't be loaded via |
@joeldbirch Thanks for the detailed report! Yes, it does seem like a bug. I have not been able to reproduce this yet, but those elements should simply be skipped over, the order should not be changing. Do you have a URL where I can run the HTML Compressor on the HTML to see this happening? I don't need Dashboard access or anything, just a link to a page that contains the HTML that I can compress to see the order out of place. |
Here is the html prior to compression. Obviously, none of the asset references will work, but it sounds like you don't need any of that. Hope it helps. Just let me know if you need anything else. |
An additional note: I thought I could work around this by changing to the option "No, do not combine JS from <head> into fewer files", but the Modernizr script tag was still rendered above the CSS references. Then I added another change "No, do not combine CSS from <head> and <body> into fewer files." and finally the order was correct. Just some more data to consider. |
Sorry. Previous comment edited to encode angle brackets. |
Issue identified. A |
A |
cc @raamdev This is now a known issue. Just a quick heads up :-) |
Nice work! I'll add some |
@joeldbirch Great, thanks again for reporting :-) This bug has been fixed in the dev branch. @raamdev Will likely pull this into Quick Cache Pro soon. When he does (i.e. after you upgrade), here is something else to be aware of, just to help avoid confusion. Given the example you provided above, with this input...
The expected output would be...
At first glance, this might still seem to be out of order. However, it is to be expected. The order of CSS and JS tags is preserved, but they are also grouped by the HTML Compressor to ensure that CSS (as a data classification) always comes first. Therefore, if you see your JavaScript (which was at the top), moved under CSS, this is normal. It's a best practice that we follow to improve page speed. The order of the CSS and JS (within each respective group; i.e. classification) should remain preserved now though, even when a |
cc @raamdev I will push this fix into the next official release of the HTML Compressor. Coming soon. |
@jaswsinc Thanks! The HTML Compressor will be updated with this fix for the next Quick Cache release. |
Hello,
I think this is a bug; it certainly seems counterintuitive.
Using Quick Cache Pro I have all the "HTML Compression Options" set to "yes" except for "remote resources" and "final HTML code". I am also listing exclusions for files that I don't want moving to the footer or compressing. These exclusions are being honoured correctly, except that the files they match are being moved into an order I do not want. I'm not sure if this is only related to the Quick Cache Pro plugin (if so please let me know and I'll post an issue there instead).
CSS Exclusion Patterns:
style.css
JavaScript Exclusion Patterns:
Typekit
modernizr.js
Prior to compression my
<head>
section is similar to this (simplified pseudo-code) and I'd like the element order to remain this way (hence the exclusions above):Once the plugin has done its magic the
<head>
elements are ordered thusly:Other files (not shown) are of course compressed and moved to the footer correctly. However, the head elements that I excluded have been reordered in a way I don't like. My expectation is that by excluding them from compression they should remain untouched in the order I left them.
Is this a bug? If not, what is the reason for the reordering and is there a workaround?
Thank you very much for your time.
The text was updated successfully, but these errors were encountered: