2017 © Pedro Peláez
 

library yacm

image

danbettles/yacm

  • Sunday, July 19, 2015
  • by danbettles
  • Repository
  • 1 Watchers
  • 0 Stars
  • 206 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

Yet Another CSS Minifier

YACM is a lightweight, but effective, CSS minifier. It is slightly different from other minifiers in that it preserves the approximate vertical structure of the original CSS - so unless the formatting of the input is very unusual, the output should be just about readable., (*1)

The code is unit-tested and can be installed using Composer., (*2)

This code is based on a Gist of mine., (*3)

Basic Usage

use Danbettles\Yacm\Minifier as CssMinifier;

//@todo Load the library.

$minifiedCss = CssMinifier::minifyNow('body { font-size: 1em; }');

//Or

$cssMinifier = new CssMinifier();
$minifiedCss = $cssMinifier->minify('body { font-size: 1em; }');

Use with BundleFu

You can minify the CSS bundled by BundleFu by calling YACM in a CallbackFilter filter., (*4)

//@todo Create bundle as per Dots United's instructions.

$minifyCssFilter = new \DotsUnited\BundleFu\Filter\CallbackFilter(function($content) {
    return \Danbettles\Yacm\Minifier::minifyNow($content);
});

$bundle->setCssFilter($minifyCssFilter);

//@todo Continue using bundle as per Dots United's instructions.

If you need to add multiple CSS filters to your bundle then follow Dots United's instructions on creating and using a filter chain., (*5)

Installation

Install using Composer., (*6)

composer require danbettles/yacm:dev-master

The Versions

19/07 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

19/07 2015

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

  • php >=5.4.0