Skip to content

Commit

Permalink
adding new filter for css uri rewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
Joeke Kloosterman authored and Joeke Kloosterman committed Jan 18, 2016
1 parent 7d09a89 commit 3c83801
Showing 1 changed file with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
* This file is part of the Assetic package, an OpenSky project.
*
* (c) 2010-2014 OpenSky Project Inc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Assetic\Filter;

use Assetic\Asset\AssetInterface;

/**
* URI rewrite from mrclay Minify
*
* @link https://github.com/mrclay/minify/blob/master/lib/Minify/CSS/UriRewriter.php
*/
class CSSUriRewriteFilter implements FilterInterface
{
public function filterLoad(AssetInterface $asset)
{
}

public function filterDump(AssetInterface $asset)
{
$sourceBase = $asset->getSourceRoot();
$sourcePath = $asset->getSourcePath();
$targetPath = $asset->getTargetPath();

if (null === $sourcePath || null === $targetPath || $sourcePath == $targetPath) {
return;
}

$content = \Minify_CSS_UriRewriter::rewrite(
$asset->getContent()
,$options['currentDir']
,$options['docRoot']
,$options['symlinks']
);

// $asset->setContent(\Minify_CSS_UriRewriter::minify($asset->getContent()));
}
}

0 comments on commit 3c83801

Please sign in to comment.