本文整理匯總了PHP中lessc::findImport方法的典型用法代碼示例。如果您正苦於以下問題:PHP lessc::findImport方法的具體用法?PHP lessc::findImport怎麽用?PHP lessc::findImport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lessc
的用法示例。
在下文中一共展示了lessc::findImport方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDependencies
public function getDependencies($path)
{
$text = file_get_contents($path);
// Find all '@import' statements.
$imports = array();
if (!preg_match_all('/^\\s*@import\\s+"([^"]+)"\\s*;/m', $text, $imports)) {
return null;
}
$dependencies = array();
$less = new \lessc($path);
foreach ($imports[1] as $f) {
// Imported CSS files are kepts as @import statements in the compiled
// file so they don't count as bake dependencies.
if (pathinfo($f, PATHINFO_EXTENSION) == 'css') {
continue;
}
$import = $less->findImport($f);
if ($import) {
$dependencies[] = $import;
} else {
throw new PieCrustException("Can't find dependency '" . $f . "' for LESS file: " . $path);
}
}
return $dependencies;
}