bootpress/asset

Caches and delivers assets of every sort, from any location, with hands-off versioning. Manipulates images on-the-fly. Minifies and combines (on-demand) css and javascript files.

v1.0.1 2017-01-20 00:42 UTC

README

Packagist License MIT HHVM Tested PHP 7 Supported Build Status Code Climate Test Coverage

Asset::cached() is a one-stop method for all of your asset caching needs. This should be the first thing that you call. It checks to see if the page is looking for a cached asset. If it is, then it will return a response that you can $page->send(). If not, then just continue on your merry way. When you $page->display() your html, it will look for all of your assets, and convert them to cached urls.

Installation

Add the following to your composer.json file.

{
    "require ": {
        "bootpress/asset": "^1.0"
    }
}

Example Usage

<?php

use BootPress\Page\Component as Page;
use BootPress\Asset\Component as Asset;

$page = Page::html();
if ($asset = Asset::cached('assets')) {
    $page->send($asset);
}

$html = $page->display('<p>Content</p>');
$page->send(Asset::dispatch('html', $html));

License

The MIT License (MIT). Please see License File for more information.