There is no license information available for the latest version (0.1.3) of this package.

Rewrite paths in css files, includes a filter for Assetic

0.1.3 2015-01-19 14:22 UTC


Rewrite paths in css files to things like images from local to remote (or anything else). Currently only handles "root relative" url paths, ie urls that start with /.

##Installation With Composer

"require": {

Composer Update:

$ composer update kevbaldwyn/css-path-rewrite

##Usage To simply rewrite urls in a css file:

$cssFileContent = file_get_contents('/path/to/my/file.css');
$writer = new KevBaldwyn\CssPathRewrite\Rewriter($cssFileContent, '');
$output = $writer->rewrite();
file_put_contents('/path/to/my/file.css', $output);

Or if using assetic simply include in your filters array:

$css = new AssetCollection(array(
    new FileAsset('/path/to/src/styles.less', array(new LessFilter())),
    new GlobAsset('/path/to/css/*'),
), array(
    new KevBaldwyn\CssPathRewrite\Assetic\Filter(''),