Git Product home page Git Product logo

cakeless's Introduction

Cakeless - A very simple lessphp plugin for CakePHP

This plugin is a very simple implementation of lessphp for CakePHP 2.x. (check 1.3 branch for CakePHP 1.3.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

cakeless's People

Contributors

sveggiani avatar electblake avatar

Watchers

jlh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.