31

Remove unused css/js from page

  • Done

Avatar
KG

Speed optimization should have an option to remove unused css and js code/files on pages. Xstore particularly has a large DOM size.

A

Activity Newest / Oldest

Avatar

8theme team

Status changed to: Done

Avatar

Jack Richardson

Hello everyone !

Few hours ago we had a big update of theme 8.0 & core 4.0 that includes many things about improvings, speed optimization, modular css/js, etc.

All changes you may find on -> xstore.8theme.com/update-history.

Thanks everyone for submitting this request and I hope this update will take you closer to speed requirements you wanted to.

Due to the fact this update contains many changes, please, try to update it on your staging sites first or do the backup of your real site first before update it there.

Regards, Jack Richardson


Avatar

stieranka

Great, just keep going...


  • Avatar
Avatar

8theme team

Status changed to: In progress

Avatar

8theme team

Status changed to: Planned

Avatar

MichaelB

@Jack - Is the OP's idea going ahead or not? I hope so as the users have spoken! +10 votes... That may not sound like a lot but it is in the top 5 voted ideas on this forum...


Avatar

KG

The files generator is rather complex and still affects performance.. there are still much codes which are unnecessarily loading on each page even if they are not used.. an automatic remover of unused css/js for every page would be highly recommended... even some plugins which have an unused css/js remover break the site due to non compatibility with the theme.


Avatar

Jack Richardson

Hello @KG,

We do our best to improve our theme functionality and theme speed. We remove unused scripts if it's not necessary for correct works of pages or post types.

Regards


Avatar

MichaelB

Posted by KG
"The files generator is rather complex and still affects performance.. there are still much codes which are unnecessarily loading on each page even if they are not used.. an automatic remover of unused css/js for every page would be highly recommended... even some plugins which have an unused css/js remover break the site due to non compatibility with the theme"

I agree with you!


Avatar

Jack Richardson

Hello, @MichaelB

In our products, we do our best to remove unused code on pages such as reducing requests of similar queries on pages to 1 global variable (for ex. post_id).
As I understand you right then you mean that we don't need to enqueue script of coundown, sticky sidebar (for example) etc. if the page does not use this shortcode/widget, right ? But if we parse each page to check if some of these widgets/elements are used on page and enqueue or not the scripts and styles the speed of the site will be more slowly due to parsing the content. Don't forget that many users use cache plugins (so on each page it should recache files?)

If you can advice us how to make it work good, please advice your thought about that. We are open to each new thought about questions that could improve our products for our customers.

Regards, Jack Richardson


  • Avatar
Avatar

amongthieves

You need to look into the theme Woodmart and how they do their CSS Generator.

Here is a picture to show you an example

prnt.sc/vu4xxt

That is like 1/6th of the list of things you can remove from the sites overall CSS files. What this theme does is, it allows you to rebuild the main themes Style.css file and remove literally any part of the CSS that you are not using. There is literally a couple hundred things you can check/uncheck and it speeds up your site SO much removing all the stuff you dont need. I dont need any portfolio stuff loaded, i dont need wishlist loaded cause im using the YITH premium wishlist, things like this. So maybe look into something like how WoodMart does there CSS Generator.


  • Avatar
Avatar

MichaelB

I'm afraid it isn't for me to say how to make the speed faster. It is upto the development to do this...


Avatar

Jack Richardson

Hello @KG,
We have added files generator in one of latest update.
For this moment it works only with css files but we are working on improving it for scripts as well.
Please, write a feedback if you are using it or you have another thought in this request.

Regards, Jack Richardson


Avatar

amongthieves

Hi Jack, there needs to be ALOT more stuff you can select on this generator. When i try to generate a CSS file with it, it breaks ALOT of stuff. Even selecting EVERY SINGLE CHECKBOX breaks stuff, and i have to completly delete the generated css to fix the broken elements.


  • Avatar
Avatar

MichaelB

Fantastic idea!

Hopefully, would sort out the slow loading times...