mirror of
https://github.com/Oreolek/kohana-less.git
synced 2024-07-01 05:55:07 +03:00
Merge branch 'master' of git://github.com/Oreolek/kohana-less
Conflicts: classes/Less/Core.php
This commit is contained in:
commit
7fda6dcd0b
|
@ -1,5 +1,10 @@
|
||||||
<?php defined('SYSPATH') or die('No direct script access.');
|
<?php defined('SYSPATH') or die('No direct script access.');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LESS wrapper for Kohana.
|
||||||
|
* @package Kohana
|
||||||
|
* @category Less
|
||||||
|
**/
|
||||||
class Less_Core
|
class Less_Core
|
||||||
{
|
{
|
||||||
// Default less files extension
|
// Default less files extension
|
||||||
|
@ -11,9 +16,11 @@ class Less_Core
|
||||||
* @param mixed array of css paths or single path
|
* @param mixed array of css paths or single path
|
||||||
* @param string value of media css type
|
* @param string value of media css type
|
||||||
* @param boolean allow compression
|
* @param boolean allow compression
|
||||||
|
* @param boolean return HTML style tag or file paths
|
||||||
* @return string link tag pointing to the css paths
|
* @return string link tag pointing to the css paths
|
||||||
|
* @return array array of css paths
|
||||||
*/
|
*/
|
||||||
public static function compile($array = '', $media = 'screen')
|
public static function compile($array = '', $media = 'screen', $html = TRUE)
|
||||||
{
|
{
|
||||||
if (is_string($array))
|
if (is_string($array))
|
||||||
{
|
{
|
||||||
|
@ -53,11 +60,26 @@ class Less_Core
|
||||||
foreach ($stylesheets as $file)
|
foreach ($stylesheets as $file)
|
||||||
{
|
{
|
||||||
$filename = self::_get_filename($file, $config['path']);
|
$filename = self::_get_filename($file, $config['path']);
|
||||||
array_push($assets, HTML::style($filename, array('media' => $media)));
|
if ($html)
|
||||||
|
{
|
||||||
|
$style = HTML::style($filename, array('media' => $media));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$style = $filename;
|
||||||
|
}
|
||||||
|
array_push($assets, $style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($html)
|
||||||
|
{
|
||||||
return implode("\n", $assets);
|
return implode("\n", $assets);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $assets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compress the css file
|
* Compress the css file
|
||||||
|
@ -116,7 +138,7 @@ class Less_Core
|
||||||
public static function _ccompile($original, $compiled)
|
public static function _ccompile($original, $compiled)
|
||||||
{
|
{
|
||||||
$config = Kohana::$config->load('less');
|
$config = Kohana::$config->load('less');
|
||||||
if ($config['vendor_internal'])
|
if ($config['vendor_internal'] === TRUE)
|
||||||
{
|
{
|
||||||
require_once '../vendor/lessphp/lessc.inc.php';
|
require_once '../vendor/lessphp/lessc.inc.php';
|
||||||
return lessc::ccompile($original, $compiled);
|
return lessc::ccompile($original, $compiled);
|
||||||
|
|
Loading…
Reference in a new issue