当前位置: 首页>>代码示例>>PHP>>正文


PHP Less_Parser::AllParsedFiles方法代码示例

本文整理汇总了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;
 }
开发者ID:bradcrumb,项目名称:lesscompiler,代码行数:31,代码来源:LessCompiler.php

示例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);
 }
开发者ID:webuni,项目名称:assetic-bundle,代码行数:25,代码来源:LessphpFilter.php

示例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 '';
    }
}
开发者ID:RadioCanut,项目名称:site-radiocanut,代码行数:46,代码来源:lesscss_fonctions.php

示例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());
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:30,代码来源:index.php

示例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) {
开发者ID:denis-zabavnikov,项目名称:Intecmedia.Bootstrap,代码行数:31,代码来源:lessc.php


注:本文中的Less_Parser::AllParsedFiles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。