Xclydes Utilities

A collection of various methods, models and libraries to aid in the addtion of optimized files such as Compressing multiple CSS files or packing multiple Javascript files into a single file, regardless of location. As well as allowing on-the-fly image resizing for. All media types can be cached with the path being returned for insertion into dynamically generated webpages.

An example of usage is a follows.

CSS

/* CSS */
try
{
Loader::model('asset_optimizer','xclydes_utilities');
AssetOptimizer::addCSS($this->getThemePath().'/css/960.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/grid.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/ie.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/ie6.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/layout.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/reset.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/text.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/main.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/etc.css');
AssetOptimizer::addCSS($this->getThemePath().'/css/font.css');
echo '<link type="text/css" href="'.AssetOptimizer::compileCSS().'" media="all" rel="stylesheet" />';
}
catch(Exception $error)
{
Log::addEntry($error->getTraceAsString());
}

 

 

JavaScript

/* JS */
try
{
Loader::model('asset_optimizer','xclydes_utilities');
AssetOptimizer::addJS($this->getThemePath().'/js/cufon-yui.js');
AssetOptimizer::addJS($this->getThemePath().'/js/fonts/Eras_Medium_ITC.font.js', TRUE, TRUE);
AssetOptimizer::addJS($this->getThemePath().'/js/fonts/Sketch_Rockwell.font.js', TRUE, TRUE);
AssetOptimizer::addJS($this->getThemePath().'/js/UI_Enhancements.js');
AssetOptimizer::addJS($this->getThemePath().'/js/autorun.js');
echo '<script type="text/javascript" src="'.AssetOptimizer::compileJS().'"></script>';
}
catch(Exception $error)
{
Log::addEntry($error->getTraceAsString());
}

 

Image

try{

       Loader::model('asset_optimizer','xclydes_utilities');
       echo '<img src="'.AssetOptimizer::optimizeIMG('/files/p1.jpg', 500).'" />';


}
catch(Exception $error)
{
Log::addEntry($error->getTraceAsString());
}



/* Directory Structure*/
//{SITE ROOT}
// ->files
// ->themes
// ->theme_folder
// ->css
// ->js
/*This is merely an example of a possible folder structure, it may vary with each configuration.*/

The 'AssetOptimizer' model is an interface to the other libraries and models contained in this package. This does not mean the other items cannot be used independently. An effort has been made to document each function to allow for usage in other libraries and models.

It should be noted that even though CSS files can be loaded from any location, the optimizer will attempt to preserve the paths (urls) in the source css file by modifying all url entries to reflect a path to the referenced file via the website root.

Version 1.0.6

  • Added a dashboard page to allow various options to be adjusted.
  • Small improvements have been made to internal operations.

A more in-depth depiction of how to use this package can be found at xclydes.com.

Add to Cart

Approved by PRB

Our 30 Day Support Policy

  • Replies to tickets every few days.

Support Hosted

  • On concrete5.org