padaliyajay/php-autoprefixer

CSS Autoprefixer written in pure PHP.

Installs: 6 149 123

Dependents: 8

Suggesters: 0

Security: 0

Stars: 42

Watchers: 4

Forks: 11

Open Issues: 0

Language:CSS

1.4 2022-08-02 02:37 UTC

This package is auto-updated.

Last update: 2024-10-18 10:21:51 UTC


README

CSS autoprefixer written in pure PHP

Installation

Simply add a dependency on padaliyajay/php-autoprefixer to your composer.json file if you use Composer to manage the dependencies of your project:

composer require padaliyajay/php-autoprefixer

Although it's recommended to use Composer, you can actually include these files anyway you want.

Usage

use Padaliyajay\PHPAutoprefixer\Autoprefixer;

$unprefixed_css = file_get_contents('main.css'); // CSS code

$autoprefixer = new Autoprefixer($unprefixed_css);
$prefixed_css = $autoprefixer->compile();

Options

prettyOutput

Example:

$autoprefixer->compile(false); // Output minified CSS

Defines if the prefixed CSS will be a verbose/prettified output. When false the output will be minified. You can pass it as an option to the compile() method.

Default: true

setVendors

Example:

$autoprefixer->setVendors(array(
    // Omit prefixes for IE
    \Padaliyajay\PHPAutoprefixer\Vendor\Webkit::class,
    \Padaliyajay\PHPAutoprefixer\Vendor\Mozilla::class,
    MyNamespace\Custom\Opera::class // Use custom vendor prefixes
));

$autoprefixer->compile();

Define which vendor classes should be used for prefixing. You can omit unwanted vendors like e.g. IE. If used, only the vendor classes in the given array will take effect.

Default:

array(
    \Padaliyajay\PHPAutoprefixer\Vendor\IE::class,
    \Padaliyajay\PHPAutoprefixer\Vendor\Webkit::class,
    \Padaliyajay\PHPAutoprefixer\Vendor\Mozilla::class,
)

License

MIT licensed.