I’m working on a project using Metronic and I’m trying to improve the page loading speed without affecting the existing JavaScript components.
I’ve already looked at image optimization and caching, but I’m not sure how much I can safely optimize or defer the Metronic JS and CSS files.
Has anyone found a good way to reduce the initial page load while keeping components like menus, modals, forms, and other interactive elements working properly?
this site:
Hi there,
You want to improve initial page load in Metronic (v8 Bootstrap or v9 Tailwind) by deferring or trimming JS/CSS, without breaking components like menus, modals, and forms.
Metronic components auto-initialize from data-kt-* attributes when the core bundle runs, so the golden rule is: keep the core bundles and their load order intact. Deferring those will break component initialization. Safe, high-impact optimizations instead:
defer or load after the page. These do not affect Metronic components.<link rel="preload" as="style" href="/assets/css/styles.css">
<link rel="preload" as="script" href="/assets/js/core.bundle.js">
loading="lazy" on <img> tags.style.bundle.css is already a single file, so focus on removing demo-specific SCSS you do not use before rebuilding.Two important warnings:
defer/async to the Metronic core bundle (core.bundle.js on v9, scripts.bundle.js on v8). The components register and initialize in a specific order; deferring them breaks menus, modals, and form validation.For Metronic 9, the Composer also lets you generate leaner page structures from reusable HTML views, which keeps the DOM smaller and speeds up rendering.
If you can share which version you are using (Metronic 8 or 9) and which demo, I can point you to the exact bundle names and a page-specific trim list. A good first pass is: run Lighthouse, remove the vendor scripts that are not used on that page, and defer the analytics snippet.
This reply was generated by AI. A human will follow up if needed.