Reputation: 2339
I am using angular 4 in Visual studio 2017 with ASP.Net MVC. I tried to bundle all the files that required to load the page. E.g
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new StyleBundle("~/bundles/css")
.Include(
"~/Assets/css/LoaderCss.css",
"~/Assets/css/style.css",
"~/Assets/css/responsive.css"
));
bundles.Add(new ScriptBundle("~/script/scripts")
.Include(
"~/" + ConfigurationManager.AppSettings["JsConfiguration"],
"~/Assets/script/jquery.min.js",
"~/node_modules/core-js/client/shim.min.js",
"~/node_modules/zone.js/dist/zone.js",
"~/node_modules/systemjs/dist/system.src.js",
"~/systemjs.config.js"
));
BundleTable.EnableOptimizations = true;
}
and used on _LayoutPage.cshtml
@Styles.Render("~/bundles/css")
@Scripts.Render("~/script/scripts")
But while loading the page all the required modules/files start loading that makes home page little slow. its because delay loading. e.g
Any idea how we can optimize this?
Upvotes: 0
Views: 304
Reputation: 1313
Maybe you should start observing the elements, which of them is taking longer. Sometimes a "big" sized file can cause the delay.
For Prototypjs framework. You may use
document.observe('dom:loaded', function() {
// do something here
});
from Prototype API documentation.
For node.js https://www.npmjs.com/package/observe
You may even use DeveloperTools in detail to find the "problematic" files.
Upvotes: 1