ElkArte Community

Elk Development => Theme development => Topic started by: Spuds on March 31, 2023, 02:29:25 pm

Title: CSS/JS Minimize Changes (playing)
Post by: Spuds on March 31, 2023, 02:29:25 pm
ElkArte can minimize and combine CSS and JS files to save on data requests and size.  That is nothing new, its been available since 1.0.

In 2.0 I made changes and you now have the option to minimize and NOT combine -or- minimize and combine the files.  In addition 2.0 will also minimize the inline JS and CSS.  There can be some debate on whether to combine or not, but if your server is running http2 then you are best not combining (IMO)

Another change is that it does a true defer on the JS that has been set as deferred.  In 1.0/1.1 defer simply means the script is added at the end of the html.  With defer, parsing finishes like when we put the script at the end of the body tag, but overall the script execution finishes before, because the script has been downloaded in parallel with the HTML parsing.  So basically it will be somewhat more performant but not as in OMG.  And no you can not simply defer everything.

Thinking that some may want to play with this (on 1.1) and see if they get any improvements, here you go!  (not this will NOT combine, only minimize) Starting with how to do this on the default theme. 

Title: Re: CSS/JS Minimize Changes (playing)
Post by: Spuds on March 31, 2023, 05:49:01 pm
I should have noted in the above post, that if you use a custom theme that does NOT have its own Theme.php file .... Then doing the steps outlined above will enable the new behavior on your custom theme as well (since if it doe NOT have its own Theme.php file, then its using the default one)