Skip to content
This repository

LESS implementation in PHP

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 lessc
Octocat-spinner-32 lessmon
Octocat-spinner-32 reset.css
Octocat-spinner-32 test.less
Octocat-spinner-32 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.