• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP lessc类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: run

 public function run()
 {
     if (!$this->srcPath) {
         throw new \UnexpectedValueException("Please specify srcPath first.");
     }
     if (!$this->targetPath) {
         throw new \UnexpectedValueException("Please specify targetPath first.");
     }
     if (!is_dir($this->targetPath)) {
         mkdir($this->targetPath, 0777);
     }
     $lastLessEditTime = 0;
     foreach (\Nette\Utils\Finder::find("*.less")->from($this->getSrcPath()) as $file) {
         $lastLessEditTime = max($lastLessEditTime, $file->getMTime());
     }
     $lastCompileTime = 0;
     foreach (\Nette\Utils\Finder::find("*.css")->from($this->getTargetPath()) as $file) {
         $lastCompileTime = max($lastCompileTime, $file->getMTime());
     }
     $compiler = new \lessc();
     foreach ($this->getfilesMapping() as $src => $target) {
         if (!is_file($this->targetPath . "/" . $target) || $lastLessEditTime > $lastCompileTime) {
             $compiler->compileFile($this->srcPath . "/" . $src, $this->targetPath . "/" . $target);
         }
     }
 }
开发者ID:mlezitom,项目名称:less-compiler,代码行数:26,代码来源:LessCompiler.php


示例2: CompileOptionsLess

function CompileOptionsLess($inputFile)
{
    global $dynamo_tpl;
    require_once get_template_directory() . '/dynamo_framework/lib/lessc.inc.php';
    $less = new lessc();
    $less->setPreserveComments(true);
    $url = "'" . get_template_directory_uri() . "'";
    $body_bg_image = "'" . get_option($dynamo_tpl->name . '_body_bg_image') . "'";
    $page404_bg_image = "'" . get_option($dynamo_tpl->name . '_page404_bg_image') . "'";
    $subheader_area_bgimage = "'" . get_option($dynamo_tpl->name . '_subheader_area_bgimage') . "'";
    $branding_logo_image = "'" . get_option($dynamo_tpl->name . '_branding_logo_image') . "'";
    $expander_bgimage = "'" . get_option($dynamo_tpl->name . '_expander_bgimage') . "'";
    $footer_bg_image = "'" . get_option($dynamo_tpl->name . '_footer_bg_image') . "'";
    $expander_bgimage = "'" . get_option($dynamo_tpl->name . '_expander_bgimage') . "'";
    $footerbgtype = 'n';
    if (get_option($dynamo_tpl->name . '_footer_pattern', 'none') != 'none') {
        $footerbgtype = 'p';
    }
    if (get_option($dynamo_tpl->name . '_footer_bg_image') != '') {
        $footerbgtype = 'i';
    }
    $expanderbgtype = 'n';
    if (get_option($dynamo_tpl->name . '_expander_pattern', 'none') != 'none') {
        $expanderbgtype = 'p';
    }
    if (get_option($dynamo_tpl->name . '_expander_bgimage') != '') {
        $expanderbgtype = 'i';
    }
    $less->setVariables(array("url" => $url, "fontsize_body" => get_option($dynamo_tpl->name . '_fontsize_body', '13px'), "fontsize_h1" => get_option($dynamo_tpl->name . '_fontsize_h1', '40px'), "fontsize_h2" => get_option($dynamo_tpl->name . '_fontsize_h2', '30px'), "fontsize_h3" => get_option($dynamo_tpl->name . '_fontsize_h3', '18px'), "fontsize_h4" => get_option($dynamo_tpl->name . '_fontsize_h4', '16px'), "fontsize_h5" => get_option($dynamo_tpl->name . '_fontsize_h5', '14px'), "fontsize_h6" => get_option($dynamo_tpl->name . '_fontsize_h6', '12px'), "maincontent_accent_color" => get_option($dynamo_tpl->name . '_maincontent_accent_color', '#3296dc'), "maincontent_secondary_accent_color" => get_option($dynamo_tpl->name . '_maincontent_secondary_accent_color', '#000000'), "page_wrap_state" => get_option($dynamo_tpl->name . '_page_wrap_state', 'streched'), "page_bgcolor" => get_option($dynamo_tpl->name . '_page_bgcolor', '#ffffff'), "page_pattern" => get_option($dynamo_tpl->name . '_page_pattern', 'none'), "body_bg_image_state" => get_option($dynamo_tpl->name . '_body_bg_image_state', 'N'), "body_bg_image" => $body_bg_image, "body_bgcolor" => get_option($dynamo_tpl->name . '_body_bgcolor', '#ffffff'), "body_pattern" => get_option($dynamo_tpl->name . '_body_pattern', 'none'), "paspartu_state" => get_option($dynamo_tpl->name . '_paspartu_state', 'N'), "paspartu_bg_color" => get_option($dynamo_tpl->name . '_paspartu_bg_color', '#ffffff'), "paspartu_width" => get_option($dynamo_tpl->name . '_paspartu_width', '30') . 'px', "top_bar_bg_color" => get_option($dynamo_tpl->name . '_top_bar_bg_color', '#000000'), "top_bar_text_color" => get_option($dynamo_tpl->name . '_top_bar_text_color', '#ffffff'), "top_bar_link_color" => get_option($dynamo_tpl->name . '_top_bar_link_color', '#3296dc'), "top_bar_hlink_color" => get_option($dynamo_tpl->name . '_top_bar_hlink_color', '#f2f2f2'), "top_bar_icon_color" => get_option($dynamo_tpl->name . '_top_bar_icon_color', '#ffffff'), "branding_logo_type" => get_option($dynamo_tpl->name . '_branding_logo_type'), "branding_logo_image" => $branding_logo_image, "branding_logo_image_width" => get_option($dynamo_tpl->name . '_branding_logo_image_width', '160') . 'px', "branding_logo_image_height" => get_option($dynamo_tpl->name . '_branding_logo_image_height', '50') . 'px', "branding_logo_top_margin" => get_option($dynamo_tpl->name . '_branding_logo_top_margin', '30') . 'px', "branding_logo_bottom_margin" => get_option($dynamo_tpl->name . '_branding_logo_bottom_margin', '10') . 'px', "sticky_logo_top_margin" => get_option($dynamo_tpl->name . '_sticky_logo_top_margin', '10') . 'px', "menu_top_bg_color" => get_option($dynamo_tpl->name . '_menu_top_bg_color', 'transparent'), "top_mainmenu_link_color" => get_option($dynamo_tpl->name . '_top_mainmenu_link_color', '#222222'), "top_mainmenu_hlink_color" => get_option($dynamo_tpl->name . '_top_mainmenu_hlink_color', '#3296dc'), "sticky_header_bgcolor" => get_option($dynamo_tpl->name . '_sticky_header_bgcolor', 'rgba(255,255,255,0.95)'), "sticky_mainmenu_link_color" => get_option($dynamo_tpl->name . '_sticky_mainmenu_link_color', '#222222'), "sticky_mainmenu_hlink_color" => get_option($dynamo_tpl->name . '_sticky_mainmenu_hlink_color', '#3296dc'), "aside_logo_image_width" => get_option($dynamo_tpl->name . '_aside_logo_image_width', '101') . 'px', "aside_logo_image_height" => get_option($dynamo_tpl->name . '_aside_logo_image_height', '35') . 'px', "aside_mainmenu_bg_color" => get_option($dynamo_tpl->name . '_aside_mainmenu_bg_color', '#ffffff'), "aside_mainmenu_link_color" => get_option($dynamo_tpl->name . '_aside_mainmenu_link_color', '#222222'), "aside_mainmenu_hlink_color" => get_option($dynamo_tpl->name . '_aside_mainmenu_hlink_color', '#3296dc'), "submenu_bgcolor" => get_option($dynamo_tpl->name . '_submenu_bgcolor', '#ffffff'), "submenu_topbordercolor" => get_option($dynamo_tpl->name . '_submenu_topbordercolor', '#3296dc'), "submenu_link_color" => get_option($dynamo_tpl->name . '_submenu_link_color', '#AFB4B9'), "submenu_hlink_color" => get_option($dynamo_tpl->name . '_submenu_hlink_color', '#AFB4B9'), "submenu_hbg_color" => get_option($dynamo_tpl->name . '_submenu_hbg_color', '#F6F6F6'), "overlay_mainmenu_bg_color" => get_option($dynamo_tpl->name . '_overlay_mainmenu_bg_color', '#ffffff'), "overlay_mainmenu_link_color" => get_option($dynamo_tpl->name . '_overlay_mainmenu_link_color', '#222222'), "overlay_mainmenu_hlink_color" => get_option($dynamo_tpl->name . '_overlay_mainmenu_hlink_color', '#3296dc'), "overlay_mainmenu_bg_color" => get_option($dynamo_tpl->name . '_overlay_mainmenu_bg_color', '#ffffff'), "overlay_mainmenu_link_color" => get_option($dynamo_tpl->name . '_overlay_mainmenu_link_color', '#222222'), "overlay_mainmenu_hlink_color" => get_option($dynamo_tpl->name . '_overlay_mainmenu_hlink_color', '#3296dc'), "overlapping_header_bgcolor" => get_option($dynamo_tpl->name . '_overlapping_header_bgcolor', '#ffffff'), "overlapping_mainmenu_link_color_light" => get_option($dynamo_tpl->name . '_overlapping_mainmenu_link_color_light', '#ffffff'), "overlapping_mainmenu_hlink_color_light" => get_option($dynamo_tpl->name . '_overlapping_mainmenu_hlink_color_light', '#3296dc'), "overlapping_mainmenu_link_color_dark" => get_option($dynamo_tpl->name . '_overlapping_mainmenu_link_color_dark', '#222222'), "overlapping_mainmenu_hlink_color_dark" => get_option($dynamo_tpl->name . '_overlapping_mainmenu_hlink_color_dark', '#3296dc'), "subheader_bgcolor" => get_option($dynamo_tpl->name . '_subheader_bgcolor', '#F7F8FA'), "subheader_pattern" => get_option($dynamo_tpl->name . '_subheader_pattern', 'none'), "subheader_area_bgimage" => $subheader_area_bgimage, "subheader_text_color" => get_option($dynamo_tpl->name . '_subheader_text_color', '#ffffff'), "expander_bgcolor" => get_option($dynamo_tpl->name . '_expander_bgcolor', '#222222'), "expander_bgimage" => $expander_bgimage, "expander_pattern" => get_option($dynamo_tpl->name . '_expander_pattern', 'none'), "expander_text_color" => get_option($dynamo_tpl->name . '_eexpander_text_color', '#ffffff'), "expander_link_color" => get_option($dynamo_tpl->name . '_expander_link_color', '#3296dc'), "expander_hlink_color" => get_option($dynamo_tpl->name . '_expander_hlink_color', '#f6f6f6'), "expanderbgtype" => $expanderbgtype, "maincontent_text_color" => get_option($dynamo_tpl->name . '_maincontent_text_color', '#7A7A7A'), "maincontent_headers_color" => get_option($dynamo_tpl->name . '_maincontent_headers_color', '#7A7A7A'), "maincontent_link_color" => get_option($dynamo_tpl->name . '_maincontent_link_color', '#3296dc'), "maincontent_hlink_color" => get_option($dynamo_tpl->name . '_maincontent_hlink_color', '#76797C'), "footer_bg_color" => get_option($dynamo_tpl->name . '_footer_bg_color', '#232D37'), "footer_bg_image" => $footer_bg_image, "footer_pattern" => get_option($dynamo_tpl->name . '_footer_pattern', 'none'), "footer_text_color" => get_option($dynamo_tpl->name . '_footer_text_color', '#BCC1C5'), "footer_header_color" => get_option($dynamo_tpl->name . '_footer_header_color', '#ffffff'), "footer_link_color" => get_option($dynamo_tpl->name . '_footer_link_color', '#ffffff'), "footer_hlink_color" => get_option($dynamo_tpl->name . '_footer_hlink_color', '#3296dc'), "footerbgtype" => $footerbgtype, "copyrightbgcolor" => get_option($dynamo_tpl->name . '_copyright_bg_color', 'rgba(0,0,0,.2)'), "copyrightbordercolor" => get_option($dynamo_tpl->name . '_copyright_border_color', 'rgba(0,0,0,0)'), "copyrighttextcolor" => get_option($dynamo_tpl->name . '_copyright_text_color', '#A2A2A2'), "copyrightlinkcolor" => get_option($dynamo_tpl->name . '_copyright_link_color', '#A2A2A2'), "copyrighthlinkcolor" => get_option($dynamo_tpl->name . '_copyright_hlink_color', '#fff'), "page404_bg_image" => $page404_bg_image, "page404_bg_image_state" => get_option($dynamo_tpl->name . '_404_bg_image_state', 'N')));
    $less->compileFile(get_template_directory() . '/css/less/' . $inputFile, get_template_directory() . '/css/dynamic.css');
}
开发者ID:Karpec,项目名称:geo-mac,代码行数:31,代码来源:helpers.dynamic.css.php


示例3: parse

 /**
  * Parse a Less file to CSS
  */
 public function parse($src, $dst, $options)
 {
     $this->auto = isset($options['auto']) ? $options['auto'] : $this->auto;
     try {
         if ($this->auto) {
             /* @var FileCache $cacheMgr */
             $cacheMgr = Yii::createObject('yii\\caching\\FileCache');
             $cacheMgr->init();
             $cacheId = 'less#' . $dst;
             $cache = $cacheMgr->get($cacheId);
             if ($cache === false || @filemtime($dst) < @filemtime($src)) {
                 $cache = $src;
             }
             $less = new \lessc();
             $newCache = $less->cachedCompile($cache);
             if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) {
                 $cacheMgr->set($cacheId, $newCache);
                 file_put_contents($dst, $newCache['compiled']);
             }
         } else {
             $less = new \lessc();
             $less->compileFile($src, $dst);
         }
     } catch (Exception $e) {
         throw new Exception(__CLASS__ . ': Failed to compile less file : ' . $e->getMessage() . '.');
     }
 }
开发者ID:CleverTek,项目名称:yii2-asset-converter,代码行数:30,代码来源:Less.php


示例4: compile

 public static function compile($source, $path, $todir, $importdirs)
 {
     // call Less to compile
     $parser = new lessc();
     $parser->setImportDir(array_keys($importdirs));
     $parser->setPreserveComments(true);
     $output = $parser->compile($source);
     // update url
     $arr = preg_split(CANVASLess::$rsplitbegin . CANVASLess::$kfilepath . CANVASLess::$rsplitend, $output, -1, PREG_SPLIT_DELIM_CAPTURE);
     $output = '';
     $file = $relpath = '';
     $isfile = false;
     foreach ($arr as $s) {
         if ($isfile) {
             $isfile = false;
             $file = $s;
             $relpath = CANVASLess::relativePath($todir, dirname($file));
             $output .= "\n#" . CANVASLess::$kfilepath . "{content: \"{$file}\";}\n";
         } else {
             $output .= ($file ? CANVASPath::updateUrl($s, $relpath) : $s) . "\n\n";
             $isfile = true;
         }
     }
     return $output;
 }
开发者ID:shamsbd71,项目名称:canvas-framework,代码行数:25,代码来源:legacy.less.php


示例5: _compileCss

 /**
  * Compile CSS files used by admin ui
  *
  * @throws Exception
  */
 protected function _compileCss()
 {
     $bootstrapPath = WWW_ROOT . 'bootstrap';
     if (!file_exists($bootstrapPath)) {
         if (!$this->_clone) {
             throw new Exception('You don\'t have "bootstrap" directory in ' . WWW_ROOT);
         }
         CakeLog::info('Cloning Bootstrap...');
         chdir(WWW_ROOT);
         exec('git clone git://github.com/twitter/bootstrap');
     }
     chdir($bootstrapPath);
     exec('git checkout -f v2.2.0');
     App::import('Vendor', 'Lessc', array('file' => 'lessphp' . DS . 'lessc.inc.php'));
     $lessc = new lessc();
     $formatter = new lessc_formatter_lessjs();
     $formatter->compressColors = false;
     ini_set('precision', 16);
     $lessc->setFormatter($formatter);
     $files = array('less' . DS . 'admin.less' => CSS . 'croogo-bootstrap.css', 'less' . DS . 'admin-responsive.less' => CSS . 'croogo-bootstrap-responsive.css');
     foreach ($files as $file => $output) {
         $out = str_replace(APP, '', $output);
         if ($lessc->compileFile(WWW_ROOT . $file, $output)) {
             $text = __('CSS : %s created', $out);
             CakeLog::info($text);
         } else {
             $text = __('CSS : %s failed', $out);
             CakeLog::error($text);
         }
     }
 }
开发者ID:laiello,项目名称:plankonindia,代码行数:36,代码来源:AssetGenerator.php


示例6: auto_less_compile

function auto_less_compile($inputFile, $outputFile)
{
    // load the cache
    $cacheFile = $inputFile . ".cache";
    if (file_exists($cacheFile)) {
        $cache = unserialize(file_get_contents($cacheFile));
    } else {
        $cache = $inputFile;
    }
    // custom formatter
    $formatter = new lessc_formatter_classic();
    $formatter->indentChar = "\t";
    $less = new lessc();
    $less->setFormatter($formatter);
    try {
        // create a new cache object, and compile
        $newCache = $less->cachedCompile($cache);
        // the next time we run, write only if it has updated
        if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) {
            file_put_contents($cacheFile, serialize($newCache));
            file_put_contents($outputFile, $newCache['compiled']);
        }
    } catch (Exception $ex) {
        echo "lessphp fatal error: " . $ex->getMessage();
    }
}
开发者ID:jrevillaa,项目名称:rest_drupal,代码行数:26,代码来源:less-compile.php


示例7: __invoke

 public function __invoke($file, $minify = null)
 {
     if (!is_file($this->getOptions()->getPublicDir() . $file)) {
         throw new \InvalidArgumentException('File "' . $this->getOptions()->getPublicDir() . $file . '" not found.');
     }
     $less = new \lessc();
     $info = pathinfo($file);
     $newFile = $this->getOptions()->getDestinationDir() . $info['filename'] . '.' . filemtime($this->getOptions()->getPublicDir() . $file) . '.css';
     $_file = $this->getOptions()->getPublicDir() . $newFile;
     if (!is_file($_file)) {
         $globPattern = $this->getOptions()->getPublicDir() . $this->getOptions()->getDestinationDir() . $info['filename'] . '.*.css';
         foreach (Glob::glob($globPattern, Glob::GLOB_BRACE) as $match) {
             if (preg_match("/^" . $info['filename'] . "\\.[0-9]{10}\\.css\$/", basename($match))) {
                 unlink($match);
             }
         }
         $compiledFile = new \SplFileObject($_file, 'w');
         $result = $less->compileFile($this->getOptions()->getPublicDir() . $file);
         if (is_null($minify) && $this->getOptions()->getMinify() || $minify === true) {
             $result = \CssMin::minify($result);
         }
         $compiledFile->fwrite($result);
     }
     return $newFile;
 }
开发者ID:rickkuipers,项目名称:justless,代码行数:25,代码来源:Less.php


示例8: css

 function css($file, $media = null)
 {
     /* If file is CSS, check if there is a LESS file */
     if (preg_match('/\\.css$/i', $file)) {
         $less = preg_replace('/\\.css$/i', '.less', $file);
         if (is_file(Director::getAbsFile($less))) {
             $file = $less;
         }
     }
     /* If less file, then check/compile it */
     if (preg_match('/\\.less$/i', $file)) {
         $compiler = 'checkedCompile';
         $out = preg_replace('/\\.less$/i', '.css', $file);
         /* Force recompile if ?flush */
         if (isset($_GET['flush'])) {
             $compiler = 'compileFile';
         }
         /* Create instance */
         $less = new lessc();
         /* Automatically compress if in live mode */
         if (DIRECTOR::isLive()) {
             $less->setFormatter("compressed");
         }
         try {
             $less->{$compiler}(Director::getAbsFile($file), Director::getAbsFile($out));
         } catch (Exception $ex) {
             trigger_error("lessphp fatal error: " . $ex->getMessage(), E_USER_ERROR);
         }
         $file = $out;
     }
     /* Return css path */
     return parent::css($file, $media);
 }
开发者ID:helpfulrobot,项目名称:tardinha-silverstripe-lesscss,代码行数:33,代码来源:LessCompiler.php


示例9: doProcess

 protected function doProcess($inputPath, $outputPath)
 {
     $this->ensureInitialized();
     if ($this->jsToolOptions === false) {
         $less = new \lessc();
         if ($this->pieCrust->isCachingEnabled()) {
             $cacheUri = 'less/' . sha1($inputPath);
             $cacheData = $this->readCacheData($cacheUri);
             if ($cacheData) {
                 $lastUpdated = $cacheData['updated'];
             } else {
                 $lastUpdated = false;
                 $cacheData = $inputPath;
             }
             $cacheData = $less->cachedCompile($cacheData);
             $this->writeCacheData($cacheUri, $cacheData);
             if (!$lastUpdated || $cacheData['updated'] > $lastUpdated) {
                 file_put_contents($outputPath, $cacheData['compiled']);
             }
         } else {
             $less->compileFile($inputPath, $outputPath);
         }
     } else {
         $exe = $this->jsToolOptions['bin'];
         $options = $this->jsToolOptions['options'];
         $cmd = "{$exe} {$options} \"{$inputPath}\" \"{$outputPath}\"";
         $this->logger->debug('$> ' . $cmd);
         shell_exec($cmd);
     }
 }
开发者ID:giftnuss,项目名称:PieCrust,代码行数:30,代码来源:LessProcessor.php


示例10: bigboom_generate_custom_color_scheme

/**
 * Generate custom color scheme css
 *
 * @since 1.0
 */
function bigboom_generate_custom_color_scheme()
{
    parse_str($_POST['data'], $data);
    if (!isset($data['custom_color_scheme'])) {
        return;
    }
    if (!$data['custom_color_scheme']) {
        return;
    }
    $color_1 = $data['custom_color_1'];
    if (!$color_1) {
        return;
    }
    // Prepare LESS to compile
    $less = file_get_contents(THEME_DIR . '/css/color-schemes/mixin.less');
    $less .= ".custom-color-scheme { .color-scheme({$color_1}); }";
    // Compile
    require THEME_DIR . '/inc/libs/lessc.inc.php';
    $compiler = new lessc();
    $compiler->setFormatter('compressed');
    $css = $compiler->compile($less);
    // Get file path
    $upload_dir = wp_upload_dir();
    $dir = path_join($upload_dir['basedir'], 'custom-css');
    $file = $dir . '/color-scheme.css';
    // Create directory if it doesn't exists
    wp_mkdir_p($dir);
    @file_put_contents($file, $css);
    wp_send_json_success();
}
开发者ID:Qualitair,项目名称:ecommerce,代码行数:35,代码来源:meta-boxes.php


示例11: process

 /**
  * Process asset content
  *
  * @param   string $content
  * @param   Asset  $asset
  *
  * @return  string
  */
 public static function process($content, Asset $asset)
 {
     // Set Less
     $lc = new lessc();
     $lc->importDir = dirname($asset->source_file()) . DIRECTORY_SEPARATOR;
     return $lc->parse($content);
 }
开发者ID:alle,项目名称:assets-merger,代码行数:15,代码来源:Less.php


示例12: boot

 public function boot(Application $app)
 {
     // Validate this params.
     $this->validate($app);
     // Define default formatter if not already set.
     $formatter = isset($app['less.formatter']) ? $app['less.formatter'] : self::FORMATTER_CLASSIC;
     $sources = $app['less.sources'];
     $target = $app['less.target'];
     $targetContent = '';
     $needToRecompile = false;
     !is_array($sources) and $sources = array($sources);
     foreach ($sources as $source) {
         if (!$needToRecompile) {
             $needToRecompile = $this->targetNeedsRecompile($source, $target);
         }
         if ($needToRecompile) {
             $handle = new \lessc($source);
             $handle->setFormatter($formatter);
             $targetContent .= $handle->parse();
         }
     }
     if (isset($handle)) {
         if ($targetContent) {
             file_put_contents($target, $targetContent);
             if (isset($app['less.target_mode'])) {
                 chmod($target, $app['less.target_mode']);
             }
         } else {
             throw new \Exception("No content after parsing less source files. Please check your .less files");
         }
     }
 }
开发者ID:raphaelvigee,项目名称:ff-silex-less-provider,代码行数:32,代码来源:LessServiceProvider.php


示例13: actionLess

 public function actionLess()
 {
     Yii::import('mod.core.models.less.*');
     if (isset($_POST['Less'])) {
         $path = Yii::getPathOfAlias('webroot.themes.default.less');
         Yii::import('app.phpless.lessc');
         $less = new lessc();
         $param = array();
         foreach ($_POST['Less'] as $key => $val) {
             $param[$key] = $val;
         }
         Yii::app()->settings->set('less', $param);
         $less->setVariables($param);
         /* $less->setVariables(array(
            'btn-default-bgcolor' => '#e0e0e0', //#e0e0e0
            'btn-primary-bgcolor' => '#265a88',
            'btn-success-bgcolor' => '#419641',
            'btn-info-bgcolor' => '#2aabd2',
            'btn-warning-bgcolor' => '#eb9316',
            'btn-danger-bgcolor' => '#c12e2a',
            )); */
         $less->compileFile($path . "/bootstrap-theme.less", Yii::getPathOfAlias('webroot.themes.default.assets.css') . "/bootstrap-theme.css");
     }
     $this->render('less', array('gradient' => new LessGradient()));
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:25,代码来源:TemplateController.php


示例14: compileLess

 private function compileLess()
 {
     $lessc = new lessc();
     $lessIndexPath = DIR_TEMPLATE . '/default/stylesheet/less/index.less';
     $cssIndexPath = DIR_TEMPLATE . '/default/stylesheet/stylesheet.css';
     $lessc->checkedCompile($lessIndexPath, $cssIndexPath);
 }
开发者ID:xwmario,项目名称:manga,代码行数:7,代码来源:less.php


示例15: compileLess

 public function compileLess($inputFile, $outputFile)
 {
     if (!class_exists('lessc')) {
         require_once KPATH_FRAMEWORK . '/external/lessc/lessc.php';
     }
     // Load the cache.
     $cacheDir = JPATH_CACHE . '/kunena';
     if (!is_dir($cacheDir)) {
         KunenaFolder::create($cacheDir);
     }
     $cacheFile = "{$cacheDir}/kunena.bootstrap.{$inputFile}.cache";
     if (is_file($cacheFile)) {
         $cache = unserialize(file_get_contents($cacheFile));
     } else {
         $cache = KPATH_MEDIA . '/less/bootstrap/' . $inputFile;
     }
     $outputFile = KPATH_MEDIA . '/css/joomla25/' . $outputFile;
     $less = new lessc();
     //$less->setVariables($this->style_variables);
     $newCache = $less->cachedCompile($cache);
     if (!is_array($cache) || $newCache['updated'] > $cache['updated'] || !is_file($outputFile)) {
         $cache = serialize($newCache);
         KunenaFile::write($cacheFile, $cache);
         KunenaFile::write($outputFile, $newCache['compiled']);
     }
 }
开发者ID:anawu2006,项目名称:PeerLearning,代码行数:26,代码来源:template.php


示例16: shoestrap_buttons_css

function shoestrap_buttons_css()
{
    $btn_color = get_theme_mod('shoestrap_buttons_color');
    // Make sure colors are properly formatted
    $btn_color = '#' . str_replace('#', '', $btn_color);
    // if no color has been selected, set to #0066cc. This prevents errors with the php-less compiler.
    if (strlen($btn_color) < 3) {
        $btn_color = '#0066cc';
    }
    ?>

  <style>
    <?php 
    if (class_exists('lessc')) {
        $less = new lessc();
        $less->setVariables(array("btnColor" => $btn_color));
        $less->setFormatter("compressed");
        if (shoestrap_get_brightness($btn_color) <= 160) {
            // The code below is a copied from bootstrap's buttons.less + mixins.less files
            echo $less->compile("\n          @btnColorHighlight: darken(spin(@btnColor, 5%), 10%);\n  \n          .gradientBar(@primaryColor, @secondaryColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {\n            color: @textColor;\n            text-shadow: @textShadow;\n            #gradient > .vertical(@primaryColor, @secondaryColor);\n            border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);\n            border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);\n          }\n  \n          #gradient {\n            .vertical(@startColor: #555, @endColor: #333) {\n              background-color: mix(@startColor, @endColor, 60%);\n              background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+\n              background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+\n              background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+\n              background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10\n              background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10\n              background-repeat: repeat-x;\n            }\n          }\n  \n          .buttonBackground(@startColor, @endColor, @textColor: #fff, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {\n            .gradientBar(@startColor, @endColor, @textColor, @textShadow);\n            *background-color: @endColor; /* Darken IE7 buttons by default so they stand out more given they won't have borders */\n            .reset-filter();\n            &:hover, &:active, &.active, &.disabled, &[disabled] {\n              color: @textColor;\n              background-color: @endColor;\n              *background-color: darken(@endColor, 5%);\n            }\n          }\n          .btn, .btn-primary{\n            .buttonBackground(@btnColor, @btnColorHighlight);\n          }\n        ");
        } else {
            echo $less->compile("\n          @btnColorHighlight: darken(@btnColor, 15%);\n  \n          .gradientBar(@primaryColor, @secondaryColor, @textColor: #333, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {\n            color: @textColor;\n            text-shadow: @textShadow;\n            #gradient > .vertical(@primaryColor, @secondaryColor);\n            border-color: @secondaryColor @secondaryColor darken(@secondaryColor, 15%);\n            border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) fadein(rgba(0,0,0,.1), 15%);\n          }\n  \n          #gradient {\n            .vertical(@startColor: #555, @endColor: #333) {\n              background-color: mix(@startColor, @endColor, 60%);\n              background-image: -moz-linear-gradient(top, @startColor, @endColor); // FF 3.6+\n              background-image: -webkit-gradient(linear, 0 0, 0 100%, from(@startColor), to(@endColor)); // Safari 4+, Chrome 2+\n              background-image: -webkit-linear-gradient(top, @startColor, @endColor); // Safari 5.1+, Chrome 10+\n              background-image: -o-linear-gradient(top, @startColor, @endColor); // Opera 11.10\n              background-image: linear-gradient(to bottom, @startColor, @endColor); // Standard, IE10\n              background-repeat: repeat-x;\n            }\n          }\n  \n          .buttonBackground(@startColor, @endColor, @textColor: #333, @textShadow: 0 -1px 0 rgba(0,0,0,.25)) {\n            .gradientBar(@startColor, @endColor, @textColor, @textShadow);\n            *background-color: @endColor; /* Darken IE7 buttons by default so they stand out more given they won't have borders */\n            .reset-filter();\n            &:hover, &:active, &.active, &.disabled, &[disabled] {\n              color: @textColor;\n              background-color: @endColor;\n              *background-color: darken(@endColor, 5%);\n            }\n          }\n          .btn, .btn-primary{\n            .buttonBackground(@btnColor, @btnColorHighlight);\n          }\n        ");
        }
    }
    ?>
  </style>
  <?php 
}
开发者ID:rhensley,项目名称:shoestrap,代码行数:28,代码来源:buttons.php


示例17: jollyness_preprocess_html

function jollyness_preprocess_html(&$vars)
{
    //Process portfolio color
    if ($portfolio_category = taxonomy_vocabulary_machine_name_load('portfolio_category')) {
        $terms = taxonomy_get_tree($portfolio_category->vid);
        $less = new lessc();
        $css = '';
        $color = '';
        $class = '';
        foreach ($terms as $t) {
            $term = taxonomy_term_load($t->tid);
            $class = drupal_html_class($t->name);
            if (!empty($term->field_color)) {
                foreach ($term->field_color as $v) {
                    $color = $v[0]['value'];
                    break;
                }
            }
            if ($color) {
                $css .= ".dexp-masonry-filter,.dexp-portfolio-filter{.{$class} span:before{background-color: {$color} !important;}}";
                $css .= ".{$class} .portfolio-item-overlay{background-color: rgba(red({$color}), green({$color}), blue({$color}), 0.7) !important;}";
            }
        }
        $css = $less->compile($css);
        drupal_add_css($css, array('type' => 'inline'));
    }
}
开发者ID:antoniodltm,项目名称:pinolguitars,代码行数:27,代码来源:template.php


示例18: _compileCss

 /**
  * Compile CSS files used by admin ui
  *
  * @throws Exception
  */
 protected function _compileCss()
 {
     $bootstrapPath = $this->_croogoWebroot . 'bootstrap';
     if (!file_exists($bootstrapPath)) {
         if (!$this->_clone) {
             throw new Exception('You don\'t have "bootstrap" directory in ' . WWW_ROOT);
         }
         chdir($this->_croogoPath);
         CakeLog::info('Cloning Bootstrap...');
         $command = sprintf('git clone -b %s %s %s', escapeshellarg($this->_tags['bootstrap']), escapeshellarg($this->_repos['bootstrap']), escapeshellarg($bootstrapPath));
         CakeLog::info("\t{$command}");
         exec($command);
     }
     chdir($bootstrapPath);
     exec(sprintf('git checkout -f %s', escapeshellarg($this->_tags['bootstrap'])));
     App::import('Vendor', 'Croogo.Lessc', array('file' => 'lessphp' . DS . 'lessc.inc.php'));
     $lessc = new lessc();
     $formatter = new lessc_formatter_lessjs();
     $formatter->compressColors = false;
     ini_set('precision', 16);
     $lessc->setFormatter($formatter);
     $files = array('less' . DS . 'admin.less' => 'css' . DS . 'croogo-bootstrap.css', 'less' . DS . 'admin-responsive.less' => 'css' . DS . 'croogo-bootstrap-responsive.css');
     foreach ($files as $file => $output) {
         $file = $this->_croogoWebroot . $file;
         $output = $this->_croogoWebroot . $output;
         $out = str_replace(APP, '', $output);
         if ($lessc->compileFile($file, $output)) {
             $text = __d('croogo', 'CSS : %s created', $out);
             CakeLog::info($text);
         } else {
             $text = __d('croogo', 'CSS : %s failed', $out);
             CakeLog::error($text);
         }
     }
 }
开发者ID:saydulk,项目名称:croogo,代码行数:40,代码来源:AssetGenerator.php


示例19: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ('development' != $input->getArgument('environment') && 'production' != $input->getArgument('environment')) {
         return $output->writeln($input->getArgument('environment') . ' environment not found');
     }
     $jsMinifier = new JS();
     $cssMinifier = new CSS();
     $output->writeln('Building environment: ' . $input->getArgument('environment'));
     $output->write('Generating JavaScript build file...');
     $jsFiles = FileSystem::listDirectoryRecursive(Application::webRoot() . '/js', '/^.+\\.js$/i');
     $buildFile = fopen(Application::webRoot() . '/min/build.js', 'w');
     foreach ($jsFiles as $filePath) {
         fwrite($buildFile, file_get_contents($filePath) . "\n\n");
     }
     fclose($buildFile);
     $output->writeln('done');
     $output->write('Shrinking JavaScript...');
     $jsMinifier->add(Application::webRoot() . '/min/build.js');
     $jsMinifier->minify(Application::webRoot() . '/min/build.min.js');
     $output->writeln('done');
     $output->write('Compiling less files...');
     $less = new \lessc();
     $less->compileFile(Application::webRoot() . '/media/importer.less', Application::webRoot() . '/min/build.css');
     $output->writeln('done');
     $output->write('Shrinking css files...');
     $cssMinifier->add(Application::webRoot() . '/min/build.css');
     $cssMinifier->minify(Application::webRoot() . '/min/build.min.css');
     $output->writeln('done');
     return null;
 }
开发者ID:skamenetskiy,项目名称:bamba,代码行数:36,代码来源:Build.php


示例20: autoCompilerLess

 function autoCompilerLess($params)
 {
     global $modx;
     $inputFile = MODX_BASE_PATH . $params["input_less"];
     $outputFile = MODX_BASE_PATH . $params["output_css"];
     define("PHPLESS_CSS_PATH", dirname($outputFile) . "/");
     define("PHPLESS_IMAGESIZE", 32);
     if (!is_file(MODX_BASE_PATH . $params["input_less"])) {
         return;
     }
     if (!class_exists('lessc')) {
         include $params['less_path'] . 'lessc.inc.php';
     }
     if (!class_exists('DataUriLess')) {
         include $params['less_path'] . 'class.datauriless.php';
     }
     $cacheFile = $inputFile . ".cache";
     if (is_file($cacheFile)) {
         $cache = unserialize(file_get_contents($cacheFile));
     } else {
         $cache = $inputFile;
     }
     switch ($params['output_formating']) {
         case 'lessjs':
         case 'compressed':
             $formatter = 'lessjs';
             break;
         case 'classic':
             $formatter = $params['output_formating'];
             break;
         case 'tabing':
             $formatter = new lessc_formatter_classic();
             $formatter->indentChar = "\t";
             break;
         default:
             $formatter = 'lessjs';
             break;
     }
     $less = new lessc();
     $less->setFormatter($formatter);
     try {
         $newCache = $less->cachedCompile($cache);
     } catch (Exception $ex) {
         $modx->logEvent(0, 3, $ex->getMessage(), $e->activePlugin);
     }
     if (!is_array($cache) || $newCache["updated"] > $cache["updated"] || !is_file($outputFile)) {
         file_put_contents($cacheFile, serialize($newCache));
         $datauri = new DataUriLess($newCache['compiled']);
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP lessc_parser类代码示例发布时间:2022-05-23
下一篇:
PHP learnpath类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap