44 $callback =
function ($matches) use (
$importFilter, $sourceRoot, $sourcePath) {
45 if (!$matches[
'url'] || null === $sourceRoot) {
49 $importRoot = $sourceRoot;
51 if (
false !== strpos($matches[
'url'],
'://')) {
53 list($importScheme, $tmp) = explode(
'://', $matches[
'url'], 2);
54 list($importHost, $importPath) = explode(
'/', $tmp, 2);
55 $importRoot = $importScheme.
'://'.$importHost;
56 } elseif (0 === strpos($matches[
'url'],
'//')) {
58 list($importHost, $importPath) = explode(
'/', substr($matches[
'url'], 2), 2);
59 $importRoot =
'//'.$importHost;
60 } elseif (
'/' == $matches[
'url'][0]) {
62 $importPath = substr($matches[
'url'], 1);
63 } elseif (null !== $sourcePath) {
65 $importPath = $matches[
'url'];
66 if (
'.' != $sourceDir = dirname($sourcePath)) {
67 $importPath = $sourceDir.
'/'.$importPath;
73 $importSource = $importRoot.
'/'.$importPath;
74 if (
false !== strpos($importSource,
'://') || 0 === strpos($importSource,
'//')) {
76 } elseif (
'css' != pathinfo($importPath, PATHINFO_EXTENSION) || !file_exists($importSource)) {
83 $import->setTargetPath($sourcePath);
85 return $import->dump();
89 $lastHash = md5($content);
93 $hash = md5($content);
94 }
while ($lastHash != $hash && $lastHash = $hash);
filterImports($content, $callback, $limit=-1, &$count=0, $includeUrl=true)
getSourceRoot()
Returns an absolute path or URL to the source asset's root directory.
filterDump(AssetInterface $asset)
Filters an asset just before it's dumped.
filterLoad(AssetInterface $asset)
Filters an asset after it has been loaded.
getSourcePath()
Returns the relative path for the source asset.
getChildren(AssetFactory $factory, $content, $loadPath=null)
Returns child assets.
getContent()
Returns the loaded content of the current asset.
Represents an asset loaded via an HTTP request.
Represents an asset loaded from a file.
A filter manipulates an asset at load and dump.
__construct(FilterInterface $importFilter=null)
Constructor.
An abstract filter for dealing with CSS.
An asset has a mutable URL and content and can be loaded and dumped.
Create styles array
The data for the language used.
The asset factory creates asset objects.
Inlines imported stylesheets.
setContent($content)
Sets the content of the current asset.