本文整理汇总了PHP中Less_Parser::AllParsedFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Less_Parser::AllParsedFiles方法的具体用法?PHP Less_Parser::AllParsedFiles怎么用?PHP Less_Parser::AllParsedFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Less_Parser
的用法示例。
在下文中一共展示了Less_Parser::AllParsedFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compileFile
public function compileFile($fname, $outFname = null)
{
if (!is_readable($fname)) {
throw new Exception('load error: failed to find ' . $fname);
}
$pi = pathinfo($fname);
$oldImport = $this->importDir;
$this->importDir = (array) $this->importDir;
$this->importDir[] = realpath($pi['dirname']) . '/';
$this->allParsedFiles = array();
$this->addParsedFile($fname);
$parser = new Less_Parser(array('sourceMap' => $this->sourceMap));
$parser->SetImportDirs($this->getImportDirs());
if (count($this->registeredVars)) {
$parser->ModifyVars($this->registeredVars);
}
foreach ($this->libFunctions as $name => $func) {
$parser->registerFunction($name, $func);
}
$parser->parseFile($fname);
$out = $parser->getCss();
$parsed = Less_Parser::AllParsedFiles();
foreach ($parsed as $file) {
$this->addParsedFile($file);
}
$this->importDir = $oldImport;
if ($outFname !== null) {
return file_put_contents($outFname, $out);
}
return $out;
}
示例2: filterLoad
/**
* {@inheritdoc}
*/
public function filterLoad(AssetInterface $asset)
{
$parser = new \Less_Parser(array('compress' => 'compressed' == $this->formatter, 'relativeUrls' => false));
$importDirs = array_fill_keys((array) $this->loadPaths, '/');
$importDirs[dirname($asset->getSourceRoot() . '/' . $asset->getSourcePath())] = '/';
$webDir = $this->webDir;
$importDirs[] = function ($path) use($webDir) {
$file = $webDir . '/' . $path;
foreach (array('', '.less', '.css') as $extension) {
if (file_exists($file . $extension)) {
return array($file . $extension, null);
}
}
return null;
};
$parser->SetImportDirs($importDirs);
$content = $asset->getContent();
$parser->parse($content);
$css = $parser->getCss();
$this->cache->set(md5($content), \Less_Parser::AllParsedFiles());
$asset->setContent($css);
}
示例3: lesscss_compile
/**
* Compiler des styles inline LESS en CSS
*
* @param string $style
* contenu du .less
* @param array $contexte
* file : chemin du fichier compile
* utilise en cas de message d'erreur, et pour le repertoire de reference des @import
* @return string
*/
function lesscss_compile($style, $contexte = array())
{
static $import_dirs = null;
require_once 'less.php/Less.php';
if (is_null($import_dirs)) {
$path = _chemin();
$import_dirs = array();
foreach ($path as $p) {
$import_dirs[$p] = protocole_implicite(url_absolue($p ? $p : "./"));
}
}
$parser = new Less_Parser();
include_spip('inc/config');
$parser->setOption('sourceMap', lire_config('lesscss/activer_sourcemaps', false) == "on" ? true : false);
$parser->setImportDirs($import_dirs);
$parser->relativeUrls = true;
try {
$url_absolue = $contexte['file'] ? protocole_implicite(url_absolue($contexte['file'])) : null;
$parser->parse($style, $url_absolue);
$out = $parser->getCss();
if ($files = Less_Parser::AllParsedFiles() and count($files)) {
$l = strlen(_DIR_RACINE);
foreach ($files as $k => $file) {
if (strncmp($file, _DIR_RACINE, $l) == 0) {
$files[$k] = substr($file, $l);
}
}
$out = "/*\n#@" . implode("\n#@", $files) . "\n*" . "/\n" . $out;
}
return $out;
} catch (exception $ex) {
spip_log('less.php fatal error:' . $ex->getMessage(), 'less' . _LOG_ERREUR);
erreur_squelette("LESS : Echec compilation" . (isset($contexte['file']) ? " fichier " . $contexte['file'] : "") . "<br />" . $ex->getMessage());
return '';
}
}
示例4: Extension
//$Less->parse( '@breadcrumb-active-color: @link-hover-color;' );
//$Less->parse( '@breadcrumb-padding-vertical: 2px;' );
//$Less->parse( '@breadcrumb-padding-horizontal: 0;' );
//
//$Less->parse( '@table-cell-padding: 6px;' );
//$Less->parse( '@table-condensed-cell-padding: 5px;' );
// Panel
$Less->parse('@panel-heading-padding: 7px 10px;');
$Less->parse('@panel-body-padding: 5px 10px;');
// Thumbnail
$Less->parse('@thumbnail-padding: 6px;');
$Less->parse('@thumbnail-caption-padding: 9px;');
//$Less->parse( '@thumbnail-border: @gray-dark;' );
//$Less->parse( '@thumbnail-border-radius: 0;' );
// Component
$Less->parse('@padding-base-vertical: 4px;');
$Less->parse('@padding-base-horizontal: 10px;');
$Less->parse('@padding-large-vertical: 8px;');
$Less->parse('@padding-large-horizontal: 14px;');
$Less->parse('@padding-small-vertical: 3px;');
$Less->parse('@padding-small-horizontal: 8px;');
$Less->parse('@padding-xs-vertical: 1px;');
$Less->parse('@padding-xs-horizontal: 3px;');
$Less->parse('@border-radius-base: 3px;');
$Less->parse('@border-radius-large: 5px;');
$Less->parse('@border-radius-small: 2px;');
$Less->parse('@form-group-margin-bottom: 10px;');
$Style = FileSystem::getFileWriter(__DIR__ . '/Bootstrap.css')->getLocation();
file_put_contents($Style, $Less->getCss());
(new Extension())->getDebugger()->screenDump($Less->AllParsedFiles());
示例5: Less_Parser
$parser = new Less_Parser($env);
foreach ($inputs as $input) {
try {
$parser->parseFile($input, $rootpath);
} catch (Exception $e) {
echo "lessc: " . $e->getMessage() . " \n";
continue;
// Invalid processing
}
}
try {
file_put_contents($output, $parser->getCss());
} catch (Exception $e) {
echo "lessc: " . $e->getMessage() . " \n";
}
$lastImports[dirname($input)] = Less_Parser::AllParsedFiles();
echo "lessc: output file recompilled\n";
}
sleep(1);
}
} else {
$parser = new Less_Parser($env);
foreach ($inputs as $input) {
if ($input == '-') {
$content = file_get_contents('php://stdin');
$parser->parse($content);
} else {
try {
$parser->parseFile($input);
} catch (Exception $e) {
if (!$silent) {