We think that JavaScript is a very important part of web developing today. But sometimes we do not think about simple tips that can increase the performance of the JS. In the post we try to overview some common issues of JS and also the simple solution that helps improve the performance of Magento site.
JavaScript bundling is an optimization technique you can use to reduce the number of server requests for JavaScript files. It is achieved by merging multiple JavaScript files together into one file to reduce the number of page requests. By default, Magento 2 allows excluding the particular JavaScript files from bundling by specifying the corresponding file in exclude
node of the etc/view.xml
file for a theme. However, sometimes it’s not enough.
We continue to share our experience with Magento developers by publishing the next set of Best Practices in Magento coding. If you missed our previous article, here it is.
AJAX is a great technology that is used to improve user experience and avoid page reloads, but how can you use it in your own Magento modules? Let’s explore…
1) You should either create a controller, for example: Namespace/YourModule/controllers/AjaxController.php or create a new action in an existing controller