![]() In this example, you can see how assets are loaded on two different Magento pages – Homepage and product page.Īs you can see on example above, requireJS loaded different assets through different pages while all bundles were loaded regardless of wether they are needed or not. Therefore, I may be wrong in some of my conclusions so feel free to correct me in comments □įor start, let’s see 2 proper ways to load assets in Magento 2. I must note that official docs do not give us a lot of information and there are only few discussions online about it. How did it go? Well, do you write articles about stuff that work as expected? Magento 2 Bundling Just kidding, of course this was included in our report and was first thing I changed when we took over the project. But it does make sense because if I report it, I’ll have to fix it. We were doing Technical audit of the Magento 2 store and when I found out that Javascript and CSS files were not merged/minified/bundled I was in shock and first question that was going through my head was “shall I report this to the client?!”. Usually I was right about their expertise level but I was wrong about one thing – they didn’t “forgot” to turn these ON.Įxplaining to the client that you would probably have to refactor 80% of the code to change that “simple option” is something I wouldn’t want to go through again. When I was Junior Developer, I was so happy/angry when I discovered someone didn’t turn these ON since I was thinking that technical level of Developers who worked on site was low and we can do a lot to improve site… and of course, I could get a “quick win” with turning merging/minifying ON. Since i’m Frontend Developer, performance is my key point during analysis.įirst thing I check is wether Javascript and CSS files are merged/minified/bundled (hello bundle). ![]() One of our services is Technical audit which covers various tests on both Frontend and Backend part of the client’s store. Right before we start with “reverse” optimisation, we can use bundling to help us organise our assets and serve less files to the client which will (should) result in faster website. You could still use bundling for reducing the number of requests for a specific page but I don’t think it will be worth of it. HTTP2 is here so this technique will be probably deprecated in the future. For loading modules, we usually use some of popular module loaders such as rollup.js or RequireJS (which is Magento’s weapon of choice). Bundling is commonly used in today’s “module-based” development where some functionalities are basically split into Modules (roughly explained). Javascript bundling is a technique that groups separate files in order to reduce the number of HTTP requests that are required to load a page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |