Asset management for Kohana.
The idea involves
represents one file that needs to be included in an output. I
left that previous sentence fairly abstract on purpose. An
Asset is simply a resource to be grouped into an
You can use this module with or without configuration. Things do get a lot neater and make for easier changes if you do use configuration however do what you will.
The first class we'll introduce is
represents a single file (or asset funnily enough) and can be
used to individually render such files.
Take an example of including a CSS file on your web page, you would simply echo the following:
echo new Asset_CSS('css/screen.css');
Asset::__construct() takes a second argument, an array of
echo new Asset_CSS('css/screen.css', array( 'attributes' => array( ), 'cache_buster' => TRUE, )); ``` php <?php echo new Asset_Group(array( new Asset_CSS('css/screen.css'), new Asset_CSS('css/print.css', array('media' => 'print')), new Asset_Less('css/testing.less'), ));
Using the default Kohana config reader you could have described this like so:
<?php return array( 'groups' => array( 'stylesheets' => array( array('CSS', 'css/screen.css'), array('CSS', 'css/print.css', array( 'attributes' => array( 'media' => 'print', ), ), array('LESS', 'css/testing.less'), ), ), );
And then only had to do this in your PHP:
<?php echo new Asset_Group('stylesheets');
So really it's up to you.
These Asset types will be shipped when complete:
- Cascading StyleSheets
For use in production environement you can now use
is basically a handy decorator for caching your asset compilations.
This module is still in development currently.