Minify JS, HTML & CSS Minify

Exclude Tags From Being Moved or Minified

While it's always better to minify all of your content and move it to the bottom of the page, for some reasons, it's not always possible. In those situation's you can configure the extension to exclude certain blocks.

Stop a Script tag from being minified.

<script type="text/javascript" 
    src="http://www.example.com/some-file.js" 
    opti-skip-minify="true"></script>

Stop a Script tag from being moved to the bottom.

<script type="text/javascript" 
    src="http://www.example.com/some-file.js" 
    opti-skip-move="true"></script>

You can do the same with inline script tags, link tags (for linking to external CSS files) and style tags.

Use These Parameters in Layout XML

It's obvious how to add these parameters to hard coded scripts and styles but less obvious how to do it when the CSS or JS file has been added via Magento's layout XML. The code examples below show you how to add these parameters when using the addJs, addCss and addItem methods via a layout XML file.

<reference name="head">
	<action method="addJs">
		<name>prototype/prototype.js</name>
		<params>opti-skip-move="true" opti-skip-minify="true"</params>
	</action>
</reference>
<reference name="head">
	<action method="addCss">
		<name>css/styles.css</name>
		<params>opti-skip-move="true" opti-skip-minify="true"</params>
	</action>
</reference>
<reference name="head">
	<action method="addItem">
		<type>skin_js</type>
		<name>prototype/prototype.js</name>
		<params>opti-skip-move="true" opti-skip-minify="true"</params>
	</action>
</reference>
Post your comment

FishPig Ltd