2017 © Pedro Peláez
 

library lesserphp

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

image

marcusschwarz/lesserphp

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  • Tuesday, May 29, 2018
  • by MarcusSchwarz
  • Repository
  • 6 Watchers
  • 7 Stars
  • 1,294 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 486 Forks
  • 5 Open issues
  • 29 Versions
  • 87 % Grown

The README.md

Build Status Scrutinizer Code Quality Coverage Status, (*1)

lesserphp dev-master

http://github.com/MarcusSchwarz/lesserphp

Please note: Please bear in mind, the master branch is not up-to-date with the release branch, which is 0.6-dev. Bug fixes should go to branch 0.6-dev (php7.2 and greater) or 0.5-dev (php5.6 to php7.4). Thank you!, (*2)

lesserphp is a compiler for LESS written in PHP. It is based on lessphp bei leafo. The documentation is great, so check it out: https://www.maswaba.de/lesserphpdocs/., (*3)

Here's a quick tutorial:, (*4)

How to use in your PHP project

The only file required is lessc.inc.php, so copy that to your include directory., (*5)

The typical flow of lesserphp is to create a new instance of lessc, configure it how you like, then tell it to compile something using one built in compile methods., (*6)

The compile method compiles a string of LESS code to CSS., (*7)

<?php
require "lessc.inc.php";

$less = new lessc;
echo $less->compile(".block { padding: 3 + 4px }");

The compileFile method reads and compiles a file. It will either return the result or write it to the path specified by an optional second argument., (*8)

<?php
echo $less->compileFile("input.less");

The checkedCompile method is like compileFile, but it only compiles if the output file doesn't exist or it's older than the input file:, (*9)

<?php
$less->checkedCompile("input.less", "output.css");

If there any problem compiling your code, an exception is thrown with a helpful message:, (*10)

<?php
try {
  $less->compile("invalid LESS } {");
} catch (\Exception $e) {
  echo "fatal error: " . $e->getMessage();
}

The lessc object can be configured through an assortment of instance methods. Some possible configuration options include changing the output format, setting variables from PHP, and controlling the preservation of comments, writing custom functions and much more. It's all described in [the documentation]0., (*11)

How to use from the command line

An additional script has been included to use the compiler from the command line. In the simplest invocation, you specify an input file and the compiled css is written to standard out:, (*12)

$ plessc input.less > output.css

Using the -r flag, you can specify LESS code directly as an argument or, if the argument is left off, from standard in:, (*13)

$ plessc -r "my less code here"

Finally, by using the -w flag you can watch a specified input file and have it compile as needed to the output file:, (*14)

$ plessc -w input-file output-file

Errors from watch mode are written to standard out., (*15)

The -f flag sets the output formatter. For example, to compress the output run this:, (*16)

$ plessc -f=compressed myfile.less

For more help, run plessc --help, (*17)

The Versions

29/05 2018

0.5.3.x-dev

0.5.3.9999999-dev http://leafo.net/lessphp/

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  Sources   Download

MIT GPL-3.0

The Development Requires

28/05 2018

0.5.2.x-dev

0.5.2.9999999-dev http://leafo.net/lessphp/

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  Sources   Download

MIT GPL-3.0

The Development Requires

28/05 2018

v0.5.2

0.5.2.0 http://leafo.net/lessphp/

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  Sources   Download

MIT GPL-3.0

The Development Requires

28/05 2018

dev-master

9999999-dev https://www.maswaba.de/lesserphpdocs/

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  Sources   Download

MIT GPL-3.0

The Development Requires

02/04 2018

v0.1.3

0.1.3.0

  Sources   Download

02/04 2018

v0.1.0

0.1.0.0

  Sources   Download

02/04 2018

v0.1.1

0.1.1.0

  Sources   Download

02/04 2018

v0.1.2

0.1.2.0

  Sources   Download

02/04 2018

v0.1.4

0.1.4.0

  Sources   Download

02/04 2018

v0.1.5

0.1.5.0

  Sources   Download

02/04 2018

v0.1.6

0.1.6.0

  Sources   Download

02/04 2018

v0.2.0

0.2.0.0

  Sources   Download

02/04 2018

v0.3.0

0.3.0.0

  Sources   Download

02/04 2018

v0.3.1

0.3.1.0

  Sources   Download

02/04 2018

v0.3.2

0.3.2.0

  Sources   Download

02/04 2018

v0.3.3

0.3.3.0

  Sources   Download

02/04 2018

v0.3.4

0.3.4.0

  Sources   Download

30/09 2016

0.4.1.x-dev

0.4.1.9999999-dev http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

30/09 2016

v0.4.1

0.4.1.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

30/09 2016

0.5.1.x-dev

0.5.1.9999999-dev http://leafo.net/lessphp/

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  Sources   Download

MIT GPL-3.0

The Development Requires

30/09 2016

v0.5.1

0.5.1.0 http://leafo.net/lessphp/

lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.

  Sources   Download

MIT GPL-3.0

The Development Requires

26/09 2016

0.4.0.x-dev

0.4.0.9999999-dev http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

24/11 2014

v0.5.0

0.5.0.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

09/08 2013

v0.4.0

0.4.0.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

02/03 2013

v0.3.9

0.3.9.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

19/08 2012

v0.3.8

0.3.8.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

12/08 2012

v0.3.7

0.3.7.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

06/08 2012

v0.3.6

0.3.6.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0

11/06 2012

v0.3.5

0.3.5.0 http://leafo.net/lessphp/

lessphp is a compiler for LESS written in PHP.

  Sources   Download

MIT GPL-3.0