Join our new community forum for support & discussion

Join Now

Home Support Themes TaskHive Is there a way to reduce the number of css and js files loaded in the page

Is there a way to reduce the number of css and js files loaded in the page

  • Author
    Posts
  • heather

    I bought TaskHive and have now set it up. I just looked at the code for a simple page with just some text on it and it is loading 29 css files and 35 javascript files! Is there some way to change the theme so it only calls on the files that are needed on the page?

    yevhen developer

    Please check if there are any third-party plugins that are not neccessary for your site in WordPress/Plugins, each third-party plugin may slow down the site or cause security issues. Then please follow this tutorial step by step to optimize everything https://hivepress.io/blog/speed-up-a-directory-or-marketplace-website/
    All JS/CSS files will be merged and minified, also pages will be cached for non-registered users so pages will load much faster.

    heather

    Hi yevhen

    Thanks for the reply. I know about caching and optimising. My question is why does the theme/plugin need to load all the files in the first place. It’s all well and good minifying but as I’m sure you know merging js files can cause problems and why merge a load of code which is not being used? For instance there are no sliders on the page but it loads slick slider and all that comes with it. I do have a couple of other plugins but they are not the culprit here. It should be possible to code the theme so as to just load scripts when they are being used. I am going to have to go through and write a load of code myself to sort this. It’s a shame as otherwise the theme is good and works well.

    ihor developer

    Hi,
    Each installed extension may load its own assets, there’s no other way to make the theme/plugin extensible – for example, the Marketplace extension loads styles required for displaying orders, payouts, etc. – including these styles to the core HivePress plugin would be less efficient (since only a small percentage of HivePress websites use Marketplace). This way each website keeps only JS/CSS files that are actually used and the codebase is not bloated.
    We try to keep HivePress as lightweight as possible, e.g. we avoided CSS frameworks like Bootstrap and styled everything in pure CSS (it’s the same with JS, we keep libraries to the minimum).
    If you want to reduce the number of loaded files please merge & minify them using any preferred caching or optimization plugin, the resulting CSS file will be much smaller than expected, many other themes load the whole Bootstrap or even all the styles for third-party page builders by default.
    Hope this helps.

    heather

    okay thanks ihor, I will give it a go and see 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.