1

I created a cms blank page and i found that it loads 179 js scripts, that slow down page loading. I assume that the problem is the theme i'm using.

I want that pages loads only the stricly necessary scripts, how i could achieve this without rewriting a custom theme?

1

This is how core Magento handles JS and isn't necessarily related to any custom theme you have, even the core theme loads around 150 JS files on the homepage. As Magento 2 is using Require JS most the scripts that are loading should be required on that page already, it's just there is a looot of JS required for each page.

If you take the first lot in this screenshot:

enter image description here

  • require.js - This is required on every page
  • mixins.js - This is required on every page
  • requirejs-config.js - This is required on every page
  • jquery.mobile.custom.js - This is required on every page
  • dataPost.js - This is required on every page

You can see where I'm going, almost every file here is required on almost every page. So removing any of this will likely cause problems somewhere, meaning to remove them you'll need to create a custom theme and manually remove them on a case by case basis. Far too much for a Stack Exchange post.

0

My suggestion in this case is to create a custom page layout template. And, we don't need to inherit from others (empty, 1column, 2columns-left, etc)

Read more: https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/xml-manage.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.