mirror of
https://github.com/Oreolek/kohana-less.git
synced 2024-06-26 03:40:46 +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.');
|
||||
|
||||
/**
|
||||
* LESS wrapper for Kohana.
|
||||
* @package Kohana
|
||||
* @category Less
|
||||
**/
|
||||
class Less_Core
|
||||
{
|
||||
// Default less files extension
|
||||
|
@ -11,9 +16,11 @@ class Less_Core
|
|||
* @param mixed array of css paths or single path
|
||||
* @param string value of media css type
|
||||
* @param boolean allow compression
|
||||
* @param boolean return HTML style tag or file 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))
|
||||
{
|
||||
|
@ -53,10 +60,25 @@ class Less_Core
|
|||
foreach ($stylesheets as $file)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
return implode("\n", $assets);
|
||||
if ($html)
|
||||
{
|
||||
return implode("\n", $assets);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $assets;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +138,7 @@ class Less_Core
|
|||
public static function _ccompile($original, $compiled)
|
||||
{
|
||||
$config = Kohana::$config->load('less');
|
||||
if ($config['vendor_internal'])
|
||||
if ($config['vendor_internal'] === TRUE)
|
||||
{
|
||||
require_once '../vendor/lessphp/lessc.inc.php';
|
||||
return lessc::ccompile($original, $compiled);
|
||||
|
|
Loading…
Reference in a new issue