0

I am trying to replace all external CSS and JS files path in Magento. What is the best way to do it? Using any observer?

For example, http://magentotest.localhost/skin/frontend/rwd/default/css/styles.css would become http://magentotest.localhost/min/?f=skin/frontend/rwd/default/css/styles.css

Just trying the Minify library.

  • Maybe consider using the merge css and merge js options magento has, this way you will have to minify only 1 css file and 1 js file. – raduparvan Sep 17 '15 at 14:36
  • I dont know how merge works completely but i tried that option on another project in past, and it broke javascript functionality since may be the order of javascript files got changed – codelogn Sep 17 '15 at 14:39
1

You might get away with just changing the skin_url configuration from the admin; see System -> Configuration -> General -> Web -> Secure|Unsecure -> Base Skin URL.

In your case that would mean replacing {{unsecure_base_url}}skin/ with {{unsecure_base_url}}min/?f=skin/

If that doesn't work, one way of doing it would be to overwrite the Mage_Page_Block_Html_Head block, the getCssJsHtml method; see app/code/core/Mage/Page/Block/Html/Head.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.