Magento Themes and Magento Extensions

Merging JavaScript in Magento

Share

magento extensions

This is not very tehnical article and most of you already use this feature, however I have noticed that there are many shops that are not using Magento’s default feature to merge JavaScript files. At the time prior to Magento 1.4, JavaScript merging was included, however it was limited to 10 files. Now that’s not a case anymore.

All you need to do is:

1) Go to admin section
2) Go to System->Configuration->ADVANCED (Developer)
3) Set “Merge JavaScript Files” to Yes (“No” is default)
4) What left is to Flush Javascript/CSS Cache at Cache management admin interface.

That’s it!
Take a look at this images to compare before and after:

BEFORE:

AFTER:

Good thing is that you can do the same thing with CSS files, however it seems that it is still in beta, so if you get any problems with relative paths inside CSS files, turn this feature off.

Don’t forget that if you are planning to do it on production, do some testing in your development enviroment first.

I hope this article helped someone.

Leave a Reply

You must be logged in to post a comment.