Not sure if it's a bug or a misconfiguration of the module.
I have enabled Compression in Configuration Tab:
Gzip CSS assets
Gzip JavaScript assets
I have also enabled minifcation
CSS minification
with YUI compressor
JavaScript Minification
JSMin ~2ms
When checking Network tools in Chrome, I could see that both size uncompressed and compressed are almost the same.
And the path to CSS or JS delivered is without the "optimized" folder and without .gz extension
In Drupal 7 we had to add a new location block in NGNIX configuration.
Not sure if it is still relavant in D8:
This what I'm using:
### advagg_css and advagg_js support
##
location ~ ^/sites/default/files/(?:css|js)/optimized {
#gzip_static on; # I supposed it's not necessary if drupal/advagg are compressing it.
access_log off;
expires max;
add_header ETag "";
add_header Cache-Control "max-age=31449600, no-transform, public";
try_files $uri @rewrite;
}
Comments
Comment #2
heyyo commentedI was misunderstanding the directive gzip_static on, it has to be here.
I thought it was telling to NGINX to compress on the fly the CSS/JS but in fact it's telling to NGINX that CSS/JS are already compressed.
So I changed it like this (without optimized)
I don't undesrtand why it's not added by default on the NGNIX Drupal recipe:
https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/
But still, I don't uderstand the purpose of the optimized directory if it's not served ?
Comment #3
heyyo commentedHum if I disable the aggregation of CSS and JS in Core, Drupal is now serving optimized version of CSS and JS, but tones of them !
It seems the bundler has still issues.
Comment #4
heyyo commentedComment #5
nickdickinsonwildeOkay, you've hit 2 issues ;)
Issue 1: not serving gzip compressed assets, I'll see what I can do to make it less apache specific (at minimum include instructions to create files like you've included in this issue - I'll be looking at them for reference, thanks).
Issue 2: not serving from the optimized directory:
This is basically a documentation flaw; it is working as intended.
- As you saw, if you disabled core aggregation, the files from the optimized directory were served.
- If core aggregation is enabled: those optimized files are created and then used as needed to create the aggregates; instead of optimizing each file each time to create an aggregate, it do sit once.
There are a couple reasons, but primary is basically shown in this medium post I saw this morning:
https://medium.com/myplanet-musings/experimenting-with-drupal-and-http-2...
TL-DR: with HTTP2 better performance can be achieved with many small files rather than aggregates.
Improving the documentation is high on priority list and will be happening before full release.
Thanks for the report and details :)
Comment #7
nickdickinsonwildeFinally got around to improving this. There is now a note on the settings form if using Apache, saying automatically handled or if Nginx linking to the manual which now has instructions on how to serve the compressed assets.
Thanks for the examples and information :)