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


PHP scssc::addImportPath方法代码示例

本文整理汇总了PHP中scssc::addImportPath方法的典型用法代码示例。如果您正苦于以下问题:PHP scssc::addImportPath方法的具体用法?PHP scssc::addImportPath怎么用?PHP scssc::addImportPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scssc的用法示例。


在下文中一共展示了scssc::addImportPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: filterLoad

 public function filterLoad(AssetInterface $asset)
 {
     $lc = new \scssc();
     if ($this->compass) {
         new \scss_compass($lc);
     }
     if ($dir = $asset->getSourceDirectory()) {
         $lc->addImportPath($dir);
     }
     foreach ($this->importPaths as $path) {
         $lc->addImportPath($path);
     }
     $asset->setContent($lc->compile($asset->getContent()));
 }
开发者ID:2329697501,项目名称:CI_Assetic,代码行数:14,代码来源:ScssphpFilter.php

示例2: filterLoad

 public function filterLoad(AssetInterface $asset)
 {
     $root = $asset->getSourceRoot();
     $path = $asset->getSourcePath();
     $lc = new \scssc();
     if ($this->compass) {
         new \scss_compass($lc);
     }
     if ($root && $path) {
         $lc->addImportPath(dirname($root . '/' . $path));
     }
     foreach ($this->importPaths as $path) {
         $lc->addImportPath($path);
     }
     $asset->setContent($lc->compile($asset->getContent()));
 }
开发者ID:Robert-Xie,项目名称:php-framework-benchmark,代码行数:16,代码来源:ScssphpFilter.php

示例3: filterLoad

 public function filterLoad(AssetInterface $asset)
 {
     $sc = new \scssc();
     if ($this->compass) {
         new \scss_compass($sc);
     }
     if ($dir = $asset->getSourceDirectory()) {
         $sc->addImportPath($dir);
     }
     foreach ($this->importPaths as $path) {
         $sc->addImportPath($path);
     }
     foreach ($this->customFunctions as $name => $callable) {
         $sc->registerFunction($name, $callable);
     }
     $asset->setContent($sc->compile($asset->getContent()));
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:17,代码来源:ScssphpFilter.php

示例4: getChildren

 public function getChildren(AssetFactory $factory, $content, $loadPath = null)
 {
     $sc = new \scssc();
     $sc->addImportPath($loadPath);
     foreach ($this->importPaths as $path) {
         $sc->addImportPath($path);
     }
     $children = array();
     foreach (CssUtils::extractImports($content) as $match) {
         $file = $sc->findImport($match);
         if ($file) {
             $children[] = $child = $factory->createAsset($file, array(), array('root' => $loadPath));
             $child->load();
             $children = array_merge($children, $this->getChildren($factory, $child->getContent(), $loadPath));
         }
     }
     return $children;
 }
开发者ID:lk1ngaa7,项目名称:assetic,代码行数:18,代码来源:ScssphpFilter.php

示例5: input

 /**
  * Runs `scssc` against any files that match the configured extension.
  *
  * @param string $filename The name of the input file.
  * @param string $input The content of the file.
  * @throws Exception
  * @return string
  */
 public function input($filename, $input)
 {
     if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
         return $input;
     }
     App::import('Vendor', 'scssc', array('file' => $this->_settings['path']));
     if (!class_exists('scssc')) {
         throw new Exception(sprintf('Cannot not load filter class "%s".', 'scssc'));
     }
     $sc = new scssc();
     $sc->addImportPath(dirname($filename));
     return $sc->compile($input);
 }
开发者ID:superstarrajini,项目名称:cakepackages,代码行数:21,代码来源:ScssPHP.php

示例6: compile

 public function compile()
 {
     // go on even if user "stops" the script by closing the browser, closing the terminal etc.
     ignore_user_abort(true);
     // set script running time to unlimited
     set_time_limit(0);
     $root_dir = $this->root_dir;
     $scss_compiler = new scssc();
     $scss_compiler->setNumberPrecision(10);
     $scss_compiler->stripComments = $this->strip_comments;
     $scss_compiler->addImportPath(function ($path) use($root_dir) {
         $path = $root_dir . $path . '.scss';
         $path_parts = pathinfo($path);
         $underscore_file = $path_parts['dirname'] . '/_' . $path_parts['basename'];
         if (file_exists($underscore_file)) {
             $path = $underscore_file;
         }
         if (!file_exists($path)) {
             return null;
         }
         return $path;
     });
     // set the path to your to-be-imported mixins. please note: custom paths are coming up on future releases!
     //$scss_compiler->setImportPaths($scss_folder);
     // set css formatting (normal, nested or minimized), @see http://leafo.net/scssphp/docs/#output_formatting
     $scss_compiler->setFormatter($this->formatter);
     // get .scss's content, put it into $string_sass
     $string_sass = '';
     if (is_array($this->scss_file)) {
         foreach ($this->scss_file as $scss_file) {
             $string_sass .= file_get_contents($scss_file);
         }
     } else {
         $string_sass = file_get_contents($this->scss_file);
     }
     // try/catch block to prevent script stopping when scss compiler throws an error
     try {
         // compile this SASS code to CSS
         $string_css = $scss_compiler->compile($string_sass) . "\n";
         // $string_css = csscrush_string($string_css, $options = array('minify' => true));
         // write CSS into file with the same filename, but .css extension
         file_put_contents($this->css_file, $string_css);
     } catch (Exception $e) {
         // here we could put the exception message, but who cares ...
         echo $e->getMessage();
         exit;
     }
 }
开发者ID:staabm,项目名称:redaxo,代码行数:48,代码来源:scss_compiler.php

示例7: generate_css_for_location

 /**
  * Compiles raw SCSS into CSS for a particular menu location.
  *
  * @since 1.3
  * @return mixed
  * @param array $settings
  * @param string $location
  */
 public function generate_css_for_location($location, $theme, $menu_id)
 {
     $scssc = new scssc();
     $scssc->setFormatter('scss_formatter');
     $import_paths = apply_filters('megamenu_scss_import_paths', array(trailingslashit(get_stylesheet_directory()) . trailingslashit("megamenu"), trailingslashit(get_stylesheet_directory()), trailingslashit(get_template_directory()) . trailingslashit("megamenu"), trailingslashit(get_template_directory()), trailingslashit(WP_PLUGIN_DIR)));
     foreach ($import_paths as $path) {
         $scssc->addImportPath($path);
     }
     try {
         return $scssc->compile($this->get_complete_scss_for_location($location, $theme, $menu_id));
     } catch (Exception $e) {
         $message = __("Warning: CSS compilation failed. Please check your changes or revert the theme.", "megamenu");
         return new WP_Error('scss_compile_fail', $message . "<br /><br />" . $e->getMessage());
     }
 }
开发者ID:hieu-pv,项目名称:danaband,代码行数:23,代码来源:style-manager.class.php

示例8: url

    $CSS = $root . '/assets/css/default.css';
    $CSSKirbyPath = 'assets/css/default.css';
}
// Get file modification times. Used for checking if update is required and as version number for caching.
$SCSSFileTime = filemtime($SCSS);
$CSSFileTime = filemtime($CSS);
// Update CSS when needed.
if (!file_exists($CSS) or $SCSSFileTime > $CSSFileTime) {
    // Activate library.
    require_once $root . '/site/plugins/scssphp/scss.inc.php';
    $parser = new scssc();
    // Setting compression provided by library.
    $parser->setFormatter('scss_formatter_compressed');
    // Setting relative @import paths.
    $importPath = $root . '/assets/scss';
    $parser->addImportPath($importPath);
    // Place SCSS file in buffer.
    $buffer = file_get_contents($SCSS);
    // Compile content in buffer.
    $buffer = $parser->compile($buffer);
    // Minify the CSS even further.
    require_once $root . '/site/plugins/scssphp/minify.php';
    $buffer = minifyCSS($buffer);
    // Update CSS file.
    file_put_contents($CSS, $buffer);
}
?>
<link rel="stylesheet" property="stylesheet" href="<?php 
echo url($CSSKirbyPath);
?>
?version=<?php 
开发者ID:irenehilber,项目名称:kirby-base,代码行数:31,代码来源:scss.php

示例9: compileCSS

 protected static function compileCSS($sourceFileWithPath, $cssFileWithPath, $sourceFileType, $vars)
 {
     global $REX;
     if (!file_exists($sourceFileWithPath)) {
         return;
     }
     // get content of source file
     $sourceFileContent = file_get_contents($sourceFileWithPath);
     // strip comments out
     $sourceFileContent = self::stripCSSComments($sourceFileContent);
     // get file path
     $path = pathinfo($sourceFileWithPath);
     // compile source file to css
     try {
         if ($sourceFileType == 'scss') {
             // EP for scss string compilation
             $compiledCSS = rex_register_extension_point('SEO42_COMPILE_SCSS', $sourceFileContent, array('vars' => $vars));
             if ($sourceFileContent == $compiledCSS) {
                 // include compiler
                 if (!class_exists('scssc')) {
                     require_once $REX['INCLUDE_PATH'] . '/addons/seo42/classes/scssphp/scss.inc.php';
                 }
                 $formatter = new scss_formatter();
                 $formatter->indentChar = "\t";
                 $formatter->close = "}" . PHP_EOL;
                 $formatter->assignSeparator = ": ";
                 $scss = new scssc();
                 $scss->addImportPath($path['dirname']);
                 $scss->setFormatter($formatter);
                 $compiledCSS = $scss->compile($sourceFileContent);
             }
         } else {
             // EP for less string compilation
             $compiledCSS = rex_register_extension_point('SEO42_COMPILE_LESS', $sourceFileContent, array('vars' => $vars, 'path' => $path['dirname']));
             if ($sourceFileContent == $compiledCSS) {
                 // include compiler
                 if (!class_exists('Less_Parser')) {
                     require_once $REX['INCLUDE_PATH'] . '/addons/seo42/classes/lessphp/Less.php';
                 }
                 $parser = new Less_Parser(array());
                 $parser->SetImportDirs(array(realpath($path['dirname']) => ''));
                 $parser->parse($sourceFileContent);
                 $parser->ModifyVars($vars);
                 $compiledCSS = $parser->getCss();
             }
         }
     } catch (Exception $e) {
         echo '" />';
         // close tag as we are probably in an open link tag in head section of website
         echo '<p style="margin: 5px;"><code>';
         echo '<strong>' . strtoupper($sourceFileType) . ' Compile Error:</strong><br/>';
         echo $e->getMessage();
         echo '</code></p>';
         exit;
     }
     // write css
     $fileHandle = fopen($cssFileWithPath, 'w');
     fwrite($fileHandle, $compiledCSS);
     fclose($fileHandle);
 }
开发者ID:omphteliba,项目名称:seo42,代码行数:60,代码来源:class.rex_resource_includer.inc.php

示例10: compile_stack

 public function compile_stack($post_id, $css_format)
 {
     // create return value
     $css = '';
     // reset fontstack array
     $this->fontstack = array();
     // setup sass compiler
     if (!class_exists('scssc')) {
         require OXY_THEME_DIR . 'vendor/leafo/scssphp/scss.inc.php';
     }
     $scss = new scssc();
     $scss->addImportPath(OXY_THEME_DIR . 'assets/scss');
     $scss->setNumberPrecision(8);
     $scss->setFormatter($css_format);
     // create sass code
     $scss_code = $this->variables($post_id);
     $scss_code .= apply_filters('oxy_stack_scss', '');
     // compile sass and store in metadata
     try {
         $css = $scss->compile($scss_code);
     } catch (Exception $e) {
         print_r($e);
     }
     // create extra font js / links
     $this->build_before_css_code($post_id);
     return $css;
 }
开发者ID:ntngiri,项目名称:Wordpress-dhaba,代码行数:27,代码来源:OxygennaStacks.php


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