electblake/cakeless

There is no license information available for the latest version (1.0.1) of this package.

A very simple plugin for using phpless (a LESS php implementation) in CakePHP

Installs: 421

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 6

Type:cakephp-plugin

1.0.1 2013-02-05 07:38 UTC

This package is not auto-updated.

Last update: 2024-12-21 14:32:39 UTC


README

This plugin is a very simple implementation of lessphp for CakePHP 2.x.

To use Cakeless download and unzip the plugin or clone git repository in plugins/cakeless.

Using the plugin

In your Controllers or App Controller

Load plugin in bootstrap.php (for CakePHP 2.x):

CakePlugin::load('Cakeless');

Include the component using:

public $components = array('Cakeless.Cakeless');

Indicate the .less file you want to compile and the desired location and filename for the compiled file. For example:

$lessExample = APP . 'plugins' . DS . 'cakeless' . DS . 'webroot' . DS . 'less' . DS . 'example.less';
$cssExample = APP . 'plugins' . DS . 'cakeless' . DS . 'webroot' . DS . 'css' . DS . 'example.css';

$this->Cakeless->compile( $lessExample, $cssExample );

This will compile the provided example file (/app/plugins/cakeless/webroot/less/example.less) to /app/plugins/cakeless/webroot/css/example.css. This could be used for testing purposes but you may want to see a more real life example. Here you have it:

$lessMainStyles = WWW_ROOT . 'less' . DS . 'main_styles.less';
$cssMainStyles = WWW_ROOT . 'css' . DS . 'main_styles.css';

$this->Cakeless->compile( $lessMainStyles, $cssMainStyles );

IMPORTANT NOTE: Compilation will only occur under debug modes 1 and above of your CakePHP application.

In your Views

Simply link to the CSS file as usual:

echo $this->Html->css( 'main_styles', null, array( 'media' => 'screen, projection' ) );

Requirements

  • PHP version: PHP 5.2+
  • CakePHP version: Cakephp 2.x Stable
  • lessphp version: 0.3.5 (no need to download, included in /vendors folder)

Support

For support and feature request, please use the repository Issues section at GitHub.

About LESS and lessphp

If you want to know more about LESS syntax please check the official LESS documentation. For lessphp extended documentation and downloads please visit the official lessphp website.

License

Copyright (c) 2011 Sebastián Veggiani, http://actionauta.com

Licensed under The MIT License (MIT)
Redistributions of files must retain the above copyright notice.

Copyright

Copyright 2011
Sebastián Veggiani