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


PHP scssc类代码示例

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


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

示例1: CssPreprocessor

function CssPreprocessor($content, $type)
{
    if ($type == 'css') {
    } else {
        if ($type == 'less') {
            try {
                $parser = new Less_Parser();
                $parser->parse($content);
                $content = $parser->getCss();
            } catch (Exception $e) {
                var_dump($e->getMessage());
            }
        } else {
            if ($type == 'sass') {
                $scss = new scssc();
                $content = $scss->compile($content);
            } else {
                if ($type == 'stylus') {
                    $stylus = new Stylus();
                    $content = $stylus->fromString($content)->toString();
                }
            }
        }
    }
    return $content;
}
开发者ID:juijs,项目名称:store.jui.io,代码行数:26,代码来源:bootstrap.php

示例2: mob_admin_compile_scss

/**
 * Compile SCSS
 * 
 * @return string
 */
function mob_admin_compile_scss($scss_folder, $css_folder, $format_style = "scss_formatter")
{
    // scssc will be loaded automatically via Composer
    $scss_compiler = new scssc();
    // set the path where your _mixins are
    $scss_compiler->setImportPaths($scss_folder);
    // set css formatting (normal, nested or minimized), @see http://leafo.net/scssphp/docs/#output_formatting
    $scss_compiler->setFormatter($format_style);
    // get all .scss files from scss folder
    $filelist = glob($scss_folder . "*.scss");
    try {
        // step through all .scss files in that folder
        foreach ($filelist as $file_path) {
            // get path elements from that file
            $file_path_elements = pathinfo($file_path);
            // get file's name without extension
            $file_name = $file_path_elements['filename'];
            // get .scss's content, put it into $string_sass
            $string_sass = mob_file_read($scss_folder . $file_name . ".scss");
            // compile this SASS code to CSS
            $string_css = $scss_compiler->compile($string_sass);
            // write CSS into file with the same filename, but .css extension
            mob_file_write($css_folder . $file_name . ".css", $string_css);
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }
}
开发者ID:markoliverbrawn,项目名称:moby-wordpress-template,代码行数:33,代码来源:admin.php

示例3: run

 /**
  * Compiles all .scss files in a given folder into .css files in a given folder
  *
  * @param string $scss_folder source folder where you have your .scss files
  * @param string $css_folder destination folder where you want your .css files
  * @param string $format_style CSS output format, see http://leafo.net/scssphp/docs/#output_formatting for more.
  */
 public static function run($scss_folder, $css_folder, $format_style = "scss_formatter", $file_append = false)
 {
     // scssc will be loaded automatically via Composer
     $scss_compiler = new scssc();
     // set the path where your _mixins are
     $scss_compiler->setImportPaths($scss_folder);
     // set css formatting (normal, nested or minimized), @see http://leafo.net/scssphp/docs/#output_formatting
     $scss_compiler->setFormatter($format_style);
     // create master css file
     if (!is_dir($css_folder) && $file_append == false) {
         file_put_contents($css_folder, "");
     }
     if (is_dir($scss_folder)) {
         $scan = scandir($scss_folder);
     } else {
         $scan = [$scss_folder];
     }
     if (!file_exists($scss_folder)) {
         throw new Exception("Arquivo inexistente: {$scss_folder}");
     }
     foreach ($scan as $file) {
         if (in_array($file, array(".", ".."))) {
             continue;
         }
         if (is_dir($scss_folder)) {
             if (!file_exists($css_folder . $file)) {
                 if (is_dir($css_folder)) {
                     if (!mkdir($css_folder . $file . "/")) {
                         throw new Exception("Falha ao compilar arquivo .scss. Não foi possível criar a pasta {$css_folder}{$file}/");
                     }
                     if (!chmod($css_folder . $file, 0755)) {
                         throw new Exception("Falha ao compilar arquivo .scss. Não foi possível mudar a permissão do arquivo {$css_folder}{$file}/ para 755 (rwxr-xr-x)");
                     }
                 }
             }
             if (is_dir($css_folder)) {
                 self::run($scss_folder . $file . "/", $css_folder . $file . "/", $format_style);
             } else {
                 self::run($scss_folder . $file, $css_folder, $format_style);
             }
         } else {
             if (preg_match('/(.*).scss$/', $file) and $file[0] != '.') {
                 // get path elements from that file
                 $file_path_elements = pathinfo($file);
                 // get file's name without extension
                 $file_name = $file_path_elements['filename'];
                 // get .scss's content, put it into $string_sass
                 $string_sass = file_get_contents($scss_folder);
                 // compile this SASS code to CSS
                 $string_css = $scss_compiler->compile($string_sass);
                 // write CSS into file with the same filename, but .css extension
                 if (is_dir($css_folder)) {
                     file_put_contents($css_folder . $file_name . ".css", $string_css);
                 } else {
                     file_put_contents($css_folder, $string_css, FILE_APPEND);
                 }
             }
         }
     }
 }
开发者ID:claudioldf,项目名称:php-sass,代码行数:67,代码来源:sass-compiler.php

示例4: compile_sass

 public static function compile_sass($parent)
 {
     if (!empty(self::$path)) {
         require "scssphp/scss.inc.php";
         $scss = new scssc();
         $scss->setImportPaths(self::$path);
         if (!$parent->args['dev_mode']) {
             $scss->setFormatter("scss_formatter_compressed");
         }
         $new_css = '';
         foreach (self::$import as $import) {
             $new_css .= $scss->compile($import);
         }
         if ($new_css != '') {
             if ($parent->args['sass']['page_output']) {
                 echo '<style type="text/css" id="redux-' . $parent->args['opt_name'] . '">' . $new_css . '</style>';
             } else {
                 //Redux_Functions::initWpFilesystem();
                 //global $wp_filesystem;
                 $filesystem = $parent->filesystem;
                 $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css');
                 //$ret_val    = $wp_filesystem->put_contents($css_file, $new_css, FS_CHMOD_FILE);
                 $ret_val = $filesystem->execute('put_contents', $css_file, array('content' => $new_css));
             }
         }
     }
 }
开发者ID:pbhanu1994,项目名称:bhanuprakash,代码行数:27,代码来源:class.redux_sass.php

示例5: compile_sass

 public static function compile_sass($parent)
 {
     if (!empty(self::$path)) {
         if (!class_exists('scssc') && !isset($GLOBALS['redux_scss_compiler'])) {
             $GLOBALS['redux_scss_compiler'] = true;
             require "scssphp/scss.inc.php";
         }
         $scss = new scssc();
         $scss->setImportPaths(self::$path);
         if (!$parent->args['dev_mode']) {
             $scss->setFormatter("scss_formatter_compressed");
         }
         $new_css = '';
         foreach (self::$import as $import) {
             $new_css .= $scss->compile($import);
         }
         if ($new_css != '') {
             if ($parent->args['sass']['page_output']) {
                 echo '<style type="text/css" id="redux-' . $parent->args['opt_name'] . '">' . $new_css . '</style>';
             } else {
                 $filesystem = $parent->filesystem;
                 $css_file = Redux_Helpers::cleanFilePath(ReduxFramework::$_upload_dir . $parent->args['opt_name'] . '-redux.css');
                 $ret_val = $filesystem->execute('put_contents', $css_file, array('content' => $new_css));
             }
         }
     }
 }
开发者ID:venturepact,项目名称:blog,代码行数:27,代码来源:class.redux_sass.php

示例6: run

 /**
  * Compiles all .scss files in a given folder into .css files in a given folder
  *
  * @param string $scss_folder source folder where you have your .scss files
  * @param string $css_folder destination folder where you want your .css files
  * @param string $format_style CSS output format, see http://leafo.net/scssphp/docs/#output_formatting for more.
  */
 public static function run($scss_folder, $css_folder, $format_style = "scss_formatter")
 {
     // scssc will be loaded automatically via Composer
     $scss_compiler = new scssc();
     // set the path where your _mixins are
     $scss_compiler->setImportPaths($scss_folder);
     // set css formatting (normal, nested or minimized), @see http://leafo.net/scssphp/docs/#output_formatting
     $scss_compiler->setFormatter($format_style);
     // get all .scss files from scss folder
     $filelist = glob($scss_folder . "*.scss");
     // step through all .scss files in that folder
     foreach ($filelist as $file_path) {
         // get path elements from that file
         $file_path_elements = pathinfo($file_path);
         // get file's name without extension
         $file_name = $file_path_elements['filename'];
         // get .scss's content, put it into $string_sass
         $string_sass = file_get_contents($scss_folder . $file_name . ".scss");
         // compile this SASS code to CSS
         $string_css = $scss_compiler->compile($string_sass);
         // create target directory if doesn't exist
         if (!is_dir($css_folder)) {
             mkdir($css_folder, 0777, true);
         }
         // write CSS into file with the same filename, but .css extension
         file_put_contents($css_folder . $file_name . ".css", $string_css);
     }
 }
开发者ID:somewebmedia,项目名称:php-sass,代码行数:35,代码来源:sass-compiler.php

示例7: __invoke

 /**
  * @see PreFileFilter::__invoke()
  */
 public function __invoke($code, \Lohini\WebLoader\WebLoader $loader, $file = NULL)
 {
     if ($file === NULL || strtolower(pathinfo($file, PATHINFO_EXTENSION)) != 'scss') {
         return $code;
     }
     $filter = new \scssc($file);
     return $filter->compile();
 }
开发者ID:lohini,项目名称:webloader,代码行数:11,代码来源:ScssFilter.php

示例8: compileScss

 function compileScss()
 {
     require "scss.inc.php";
     $scss = new scssc();
     $scss->setImportPaths(get_stylesheet_directory() . '/assets/scss/');
     $scss->setFormatter('scss_formatter_compressed');
     file_put_contents(get_stylesheet_directory() . '/assets/css/global-gen.css', $scss->compile('@import "global.scss"'));
 }
开发者ID:Johnystardust,项目名称:ecs-247-bereikbaar,代码行数:8,代码来源:compile-styles.php

示例9: init

 public function init($css = '')
 {
     require "compass/vendor/autoload.php";
     require "compass/compass.inc.php";
     $scss = new scssc();
     new scss_compass($scss);
     return $scss->compile('@import "compass";' . $css);
 }
开发者ID:rostber,项目名称:pyrocms_compass,代码行数:8,代码来源:compass.php

示例10: serveStyle

 /** Default RudraX Plug
  *
  * @RequestMapping(url="scss/{mdfile}",type=css)
  *
  */
 function serveStyle($mdfile)
 {
     include_once LIB_PATH . "/leafo/scssphp/scss.inc.php";
     $scss = new scssc();
     $scss->setFormatter("scss_formatter_compressed");
     $server = new scss_server(get_include_path(), get_include_path() . BUILD_PATH . "/scss/", $scss);
     $server->serve();
 }
开发者ID:rudraks,项目名称:core,代码行数:13,代码来源:ResourceController.php

示例11: filterLoad

 public function filterLoad(AssetInterface $asset)
 {
     $root = $asset->getSourceRoot();
     $path = $asset->getSourcePath();
     $lc = new \scssc();
     if ($root && $path) {
         $lc->addImportPath(dirname($root . '/' . $path));
     }
     $asset->setContent($lc->compile($asset->getContent()));
 }
开发者ID:JPunto,项目名称:Symfony,代码行数:10,代码来源:ScssphpFilter.php

示例12: jetpack_sass_css_preprocess

function jetpack_sass_css_preprocess($sass)
{
    require_once dirname(__FILE__) . '/preprocessors/scss.inc.php';
    $compiler = new scssc();
    try {
        return $compiler->compile($sass);
    } catch (Exception $e) {
        return $sass;
    }
}
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:10,代码来源:preprocessors.php

示例13: __construct

 /**
  * Set values for Wp_Scss::properties
  *
  * @param string scss_dir - path to source directory for scss files
  * @param string css_dir - path to output directory for css files
  * @param string method - type of compile (compressed, expanded, etc)
  *
  * @var object scssc - instantiate the compiling object.
  *
  * @var array compile_errors - catches errors from compile
  */
 public function __construct($scss_dir, $css_dir, $compile_method)
 {
     $this->scss_dir = $scss_dir;
     $this->css_dir = $css_dir;
     $this->compile_method = $compile_method;
     global $scssc;
     $scssc = new scssc();
     $scssc->setFormatter($compile_method);
     $scssc->setImportPaths($scss_dir);
     $this->compile_errors = array();
 }
开发者ID:altshift,项目名称:WP-SCSS,代码行数:22,代码来源:class-wp-scss.php

示例14: get_compiler

 /**
  * @return scssc
  */
 private function get_compiler()
 {
     if (is_null($this->compiler)) {
         if (!class_exists('scssc')) {
             require_once dirname(__FILE__) . '/Compiler/lib/scssphp/scss.inc.php';
         }
         $this->compiler = new scssc();
         $this->compiler->setImportPaths($this->get_import_paths());
         $this->compiler->setFormatter('scss_formatter_compressed');
     }
     return $this->compiler;
 }
开发者ID:firatkarakusoglu,项目名称:feedback-cat,代码行数:15,代码来源:Compiler.php

示例15: parse

 public static function parse($source, $isFile = true)
 {
     $parser = new scssc();
     if ($isFile) {
         $parser->setImportPaths(dirname($source));
     }
     try {
         return $isFile ? $parser->compile('@import "' . basename($source) . '"') : $parser->compile($source);
     } catch (Exception $e) {
         return '/** SASS PARSE ERROR: ' . $e->getMessage() . ' **/';
     }
 }
开发者ID:amdad,项目名称:BirdsLab,代码行数:12,代码来源:Sass.php


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