Location: PHPKode > projects > BackendPro > user_guide/libraries/assets/asset_optimisation.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<title>BackendPro User Guide : Asset Optimisation</title>

<style type='text/css' media='all'>@import url('../../userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../../userguide.css' />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='robots' content='all' /> 

</head>

<body>

<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"></div></div>
<div id="nav2"><a name="top">&nbsp;</a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>BackendPro User Guide Version 0.6.1</h1></td>
<td id="breadcrumb_right"><a href="../../contents.html">Table of Contents</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->

<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://www.kaydoo.co.uk/projects/backendpro">BackendPro Home</a> &nbsp;&#8250;&nbsp;
<a href="../../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;    
<a href="../assets.html">Asset Library</a> &nbsp;&#8250;&nbsp;  
Asset Optimisation
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="http://www.kaydoo.co.uk/backendpro/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>

</table>
<!-- END BREADCRUMB -->

<br clear="all" />


<!-- START CONTENT -->
<div id="content">


<h1>Asset Optimisation</h1>
<p>The <a href="../assets.html">Asset Library</a> is able to optimise assets for your users. 
If allowed the process will combine all assets into a single file. It will then optimise this 
file using optimisation plugins (if available) before storing a copy of the new file in the 
asset cache. This means the user will be served the smallest most efficent asset file possible, 
while at the same time keeping your asset files readable for development.</p>
<p>By combining assets into single files this reduces the number of HTTP requests yours 
users have to make to the site, thus speeding up the page loading times.</p>

<p class="important"><strong>Note:</strong> Please make sure <dfn>assets/cache/</dfn> is writable 
before attemtping to use Asset Optimisation.</p>

<h2>Process</h2>
<img src="../../images/asset_flow.jpg" alt="Asset Flow Process"/>

<h2>Steps</h2>

<ol>
	<li><strong>Optimise:</strong><br/>
	<p>In the Asset Library config file there is a setting <dfn>optimise_assets</dfn>. This must be set to <var>TRUE</var>
	if you want optimisation to occur. If set to <var>FALSE</var> the required assets will just be outputted.</p></li>
	
	<li><strong>Does a Cache Exist:</strong><br/>
	<p>For each type of asset (CSS or JS) and for each position (header or footer) it will check if an asset files 
	exists in the given asset cache directory.</p></li>
	
	<li><strong>Has the Cache Expired:</strong><br/>
	<p>If a cache file has been found, check it is not too old. This value is set in the Asset Library config file 
	in a setting called <dfn>asset_caching/expire_time</dfn>. This is the time in hours for which a cached asset 
	file will be kept. After this the asset cache directory will be cleaned of all old asset cache's and new ones 
	shall be created.</p></li>
	
	<li><strong>Get Contents of Assets:</strong><br/>
	<p>The process will iterate over all specified assets and combine them into a single asset file. <strong>Please 
	check the <a href="../assets.html#asset_array">Asset Array</a> config setting for details about dynamic 
	assets and how to handle them in this case.</strong></p></li>
	
	<li><strong>Run CSS Optimisation:</strong><br/>
	<p>If a CSSTidy has been specified run the optimiser, please see <a href="css_compression.html">CSS Compression</a> for 
	more details.</p></li>
	
	<li><strong>Run JS Optimisation:</strong><br/>
	<p>If a JS Packer has been specified run the packer, please see <a href="js_compression.html">JS Compression</a> for 
	more details.</p></li>
	
	<li><strong>Output Assets:</strong><br/>
	<p>Depending on if a cache was created or not. All asset files needed for the page are outputted into either the 
	header or footer of the document as required.</p></li>
</ol>


</div>
<!-- END CONTENT -->

<div id="footer">
<p>
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../../index.html">User Guide Home</a>
</p>
<p><a href="http://www.kaydoo.co.uk/projects/backendpro">BackendPro</a> &nbsp;&middot;&nbsp; Copyright &#169; 2009 &nbsp;&middot;&nbsp; <a href="http://www.kaydoo.co.uk">Adam Price</a></p>

</div>

</body>
</html>
Return current item: BackendPro