rob-mccann / asseticanesthetic
An abstraction layer to enable managing of assets via a config array. A different way of implementing Assetic.
Requires
- php: >=5.3.3
- fuelphp/common: dev-develop
- kriswallsmith/assetic: 1.1.*@dev
This package is not auto-updated.
Last update: 2024-11-03 04:29:53 UTC
README
An abstraction layer to enable managing of assets via a config array. A different way of implementing Assetic.
Installation
Installation is via Composer. Add the following to your composer.json
file.
{
"require": {
"rob-mccann/asseticanesthetic": "0.1"
}
}
Run composer install
Features
- Generate assets based on configuration
- Keeps MVC, no need for <script src="assets.php">
- Quick to install and use
- Ideal for small, quick projects where delivery is a higher requirement than raw performance
Usage
This project is framework independent. You can use it in almost any PHP project.
First, you'll need to create a new object and pass it in our wonderful config array (see the examples
to see what to pass in here).
$assets = new \AsseticAnesthetic\SimpleAssetManager($config);
You can then call $assets->renderJs()
and $assets->renderCss()
to render the HTML tags.
Most of the time, you'll want to load $config from your frameworks Config class. In Laravel and FuelPHP, it's something along the lines of $config = Config::read('assets')
.
Enabling / Disabling groups
Before you call the render functions, you can override your config to enable or disable groups.
// the following will enable jQuery UI if it exists, but
// will then disable the jquery-ui css from being processed and shown
$assets->enable('jquery-ui');
$assets->disable('jquery-ui', SimpleAssetManager::CSS);
Todo
- Write proper tests
- Implement more filters
- Improve documentation