문제

I added a custom JS file, that is located under the following:

/skin/frontend/theme/theme/js/frontend.js

But when I run a speedtest, that file is not compressed and loaded into the Magento merged JS file. It is just loaded outside the merged file.

How can I add this file, so that it will be added to the merged JS?

도움이 되었습니까?

해결책

How did you make Magento load your javascript file? Make sure you add the Javascript file correctly inside a layout Xml file:

<?xml version="1.0"?>
<layout>
    <default>
        <reference name="head">
            <action method="addItem">
                <type>skin_js</type>
                <name>js/frontend.js</name>
            </action>
        </reference>
    </default>
</layout>

Remove the existing merged Javascript file, clean cache so Magento regenerate the merged Javascript file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top