tubalmartin/cssmin
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Tubalmartin/Cssmin is a PHP port of the YUI CSS compressor. Its main objective is to significantly reduce the size of CSS code, which enhances the loading speed of webpages. This Composer package is based on version 2.4.8 of the original YUI compressor, and it includes modifications and features not present in the YUI version. Among its various features, it preserves CSS comments that are important for licensing purposes and splits long CSS lines for improved compatibility with source control tools.
Using Tubalmartin/Cssmin begins with the Composer command $ composer.phar require tubalmartin/cssmin
to include this library into your project. Once installed, you make use of the library by requiring Composer's autoloader file and creating a new instance of the compressor:
<?php
require './vendor/autoload.php';
use tubalmartin\CssMin\Minifier as CSSmin;
// Use it!
$compressor = new CSSmin;
To use this library to compress CSS code, you may follow the example detailed in the readme:
<?php
require './vendor/autoload.php';
use tubalmartin\CssMin\Minifier as CSSmin;
$input_css = file_get_contents('test.css');
$compressor = new CSSmin;
$compressor->keepSourceMapComment();
$compressor->removeImportantComments();
$compressor->setLineBreakPosition(1000);
$compressor->run($input_css);
echo $output_css;
The Tubalmartin/Cssmin documentation can be found in the readme on its GitHub page at github.com/tubalmartin/YUI-CSS-compressor-PHP-port. Presented in an organized and detailed manner, the documentation includes a table of contents that guides users through sections including Installation & Requirements, How to Use, Tests, API Reference, and a Changelog. Each section provides comprehensive information, example usage of methods, command-line interface commands, and a graphic user interface walkthrough. Detailed explanations for every available method calls in the API are also provided.