Skip to content
LESS implementation in PHP
PHP
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
LICENSE
README
lessc
lessmon
reset.css
test.less
test2.less

README

Less.php let's you convert .less files into .css

Versions
--------
0.0.1	- First official release (beta)
0.0.3   - Stable release; bug fixes; nested functions support; @if operator support
0.0.4   - Some improvements thanks to lars-sh

How to Use
----------

Run on the console: lessc file.less > output.css

If you want you can check the lessc file so you can use the class inside your code.

Supported
---------
- variables
- mixins
- nested rules
- operations
- comments (C-style and inline)
- math functions (min, max, avg, round, ceil, floor)
- color functions (lighten, darken, greyscale)

Missing
-------
- namespaces & accessors

TBD
---
- dataurl() function to embed images in css
- suggestions?

EXAMPLE
-------

@light-blue: #111 + #111;
@default-border: .4em;
@max-border: 2em;

/**
 * First comment
 **/
.bordered (@radius: 3px; @shadow-color: rgba(100, 100, 100, .5)) {
	border-radius: @radius;
	-moz-border-radius: @radius;
	-webkit-border-radius: @radius;
	box-shadow: 0 0 3px @shadow-color;
	-moz-box-shadow: 0 0 3px @shadow-color;
	-webkit-box-shadow: 0 0 3px @shadow-color;
}

#header, #content {
	// second comment
	@red-color: #abcdef + #111;	// other comment
	a:active, a:hover {
		text-decoration: none; // one more comment
		border: @default-border + .2 solid black;
		background: url(some/file.png) left center repeat-x;
	}
	color: @light-blue * 2;
	.bordered ( 5px, );
	:hover { color: @red-color; }
	
	.item {
		color: #af6788;
	}
	&.item {
		color: red;
	}
}

#nav {
	margin: min(@max-border, 1em, .5em);
	color: darken(#ccc, 20%);		// same as lighten(#ccc, -20%)
	background: greyscale(#f00);
}

.foo { &.bar { color: black }}
Something went wrong with that request. Please try again.