Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' of git://github.com/Oreolek/kohana-less
Browse files Browse the repository at this point in the history
Conflicts:
	classes/Less/Core.php
  • Loading branch information
Oreolek committed Jun 14, 2014
2 parents 4d34fa5 + 8610589 commit 7fda6dc
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions classes/Less/Core.php
@@ -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
Expand All @@ -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))
{
Expand Down Expand Up @@ -53,10 +60,25 @@ public static function compile($array = '', $media = 'screen')
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;
}
}

/**
Expand Down Expand Up @@ -116,7 +138,7 @@ protected static function _get_filename($file, $path)
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);
Expand Down

0 comments on commit 7fda6dc

Please sign in to comment.