本文整理汇总了PHP中lessc::compileFile方法的典型用法代码示例。如果您正苦于以下问题:PHP lessc::compileFile方法的具体用法?PHP lessc::compileFile怎么用?PHP lessc::compileFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lessc
的用法示例。
在下文中一共展示了lessc::compileFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _compile
/**
* @param string $path
* @return string
*/
protected function _compile($path)
{
try {
return $this->_processor->compileFile($path);
} catch (Exception $ex) {
die('<strong>Less Error (JBlank):</strong><br/><pre>' . $ex->getMessage() . '</pre>');
}
}
示例2: 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()));
}
示例3: _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);
}
}
}
示例4: __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;
}
示例5: 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);
}
}
示例6: 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() . '.');
}
}
示例7: generate
function generate($fileout, $type, $theme_option_variations)
{
WP_Filesystem();
global $wp_filesystem;
$css = "";
$regex = array("`^([\t\\s]+)`ism" => '', "`^\\/\\*(.+?)\\*\\/`ism" => "", "`([\n\\A;]+)\\/\\*(.+?)\\*\\/`ism" => "\$1", "`([\n\\A;\\s]+)//(.+?)[\n\r]`ism" => "\$1\n", "`(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+`ism" => "", "/\n/i" => "");
$compiler = new lessc();
$compiler->setFormatter('compressed');
$css .= $compiler->compileFile(TP_THEME_DIR . 'less/theme-options.less');
$css .= customcss();
$css = preg_replace(array_keys($regex), $regex, $css);
$style = $wp_filesystem->get_contents(TP_THEME_DIR . "inc/theme-info.txt");
// Determine whether Multisite support is enabled
if (is_multisite()) {
// Write Theme Info into style.css
$wp_filesystem->put_contents($fileout . $type, $style, FS_CHMOD_FILE);
// Write the rest to specific site style-ID.css
$fileout = $fileout . '-' . get_current_blog_id();
$style .= $css;
$wp_filesystem->put_contents($fileout . $type, $style, FS_CHMOD_FILE);
} else {
// If this is not multisite, we write them all in style.css file
$style .= $css;
$wp_filesystem->put_contents($fileout . $type, $style, FS_CHMOD_FILE);
}
}
示例8: _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);
}
}
}
示例9: registerLessFile
public function registerLessFile($url, $media = '')
{
$this->hasScripts = true;
$lessUrl = $url;
$uniqid = md5($lessUrl);
$lessFileName = basename($lessUrl);
$cssFileName = preg_replace('/\\.less$/i', '', $lessFileName) . ".css";
$tempCachePath = Yii::getPathOfAlias('application.runtime.cache') . "/yiiless/{$uniqid}";
@mkdir($tempCachePath, 0777, true);
$cssFilePath = "{$tempCachePath}/{$cssFileName}";
if (preg_match('/^https?\\:\\/\\//', $lessUrl)) {
$lessFilePath = "{$tempCachePath}/{$lessFileName}";
} else {
if (file_exists(Yii::getPathOfAlias('webroot') . "/{$lessUrl}")) {
$lessFilePath = Yii::getPathOfAlias('webroot') . "/{$lessUrl}";
} else {
if (file_exists($lessUrl)) {
$lessFilePath = $lessUrl;
} else {
$lessFilePath = $_SERVER['DOCUMENT_ROOT'] . "/" . $lessUrl;
}
}
}
$lessCompiler = new lessc();
if ($this->cache === false) {
$lessCompiler->compileFile($lessFilePath, $cssFilePath);
} else {
$lessCompiler->checkedCompile($lessFilePath, $cssFilePath);
}
$cssUrl = Yii::app()->getAssetManager()->publish($cssFilePath);
$this->cssFiles[$cssUrl] = $media;
$params = func_get_args();
$this->recordCachingAction('clientScript', 'registerLessFile', $params);
return $this;
}
示例10: 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);
}
}
}
示例11: 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');
}
示例12: 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;
}
示例13: compileLESS
/**
* @param FileContainer $file
*
* @return $this
* @throws CompilerException
*/
protected function compileLESS(FileContainer $file)
{
try {
return $file->setOutputContent($this->less->compileFile($file->getInputPath()));
} catch (\Exception $e) {
throw new CompilerException($e->getMessage(), 1, $e);
}
}
示例14: compile
/**
* Compile the LESS at the given path.
*
* @param string $path
* @return void
*/
public function compile($path)
{
$less = new \lessc();
$contents = $less->compileFile($path);
if (!is_null($this->cachePath)) {
$this->files->put($this->getCompiledPath($path), $contents);
}
}
示例15: generate_less_css
function generate_less_css()
{
include_once __DIR__ . '/../vendor/lessc.inc.php';
$less = new lessc();
$less->setFormatter("compressed");
$less_file = __DIR__ . "/../less/site.less";
$css_file = __DIR__ . "/../css/style.css";
return $less->compileFile($less_file, $css_file);
}