-
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 inline script converted into external JS file #82
Comments
@cristi-contiu I noticed the path you posted above contains |
I have the same issue. This is a real problem because it compress code like this:
|
@cristi-contiu I'll see what we can do to improve the defaults, but you can tune this for your site by adding exclusions. See: Dashboard → Comet Cache → Plugin Options → HTML Compressor → JavaScript Exclusion Patterns In your case, add this line to the configuration if you want to exclude that snippet.
|
@playinteractive In your case, add this line:
|
Thanks man, I'll try it. |
@jaswrks Thank you for the tip! |
EXPLANATION OF THE ISSUE
I have noticed a small issue with the
compress_combine_head_js
option (htmlc_compress_combine_head_js
in WP Admin, as I use this library via your excellent CometCache plugin): When there is an inline script present in the head, it will convert it to an external JS file which requires an render-blocking HTTP request.STEPS TO REPRODUCE THE ISSUE
Add a inline script to HEAD section, for example
<script> var wp_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>'; </script>
BEHAVIOR THAT I EXPECTED
I would expect the HEAD external JS (scripts with "src") to be combined/compressed/minified, but the inline scripts (like to one above) to be ignored (maybe minified inline, via different option).
BEHAVIOR THAT I OBSERVED
The above script will be converted to:
<script type="text/javascript" src="http://example.com/wp-content/cache/zencache/htmlc/public/example-com/f/f/d/0/b/b4d1c8d399d0056c01f51915b7df5a3d-compressor-part.js?iv=1"></script>
Converting the (usually small) inline JS script to an external JS file which requires an extra HTTP request to download totally overrides any performance benefit.
The text was updated successfully, but these errors were encountered: