Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Tested with https://github.com/leafo/lessphp/tree/21a012ff48b289e3e500ebd7c45ca90d5acbd39c
- require "lessc.inc.php";
- $less = new lessc;
- // Compile example from http://stackoverflow.com/a/11198338/938089
- echo $less->compile(<<<FOOD
- @red-md: #232;
- @red-dk: #343;
- .setColor(@color) {
- (~"body.@{color}") { background-color: ~"@{@{color}-dk}";
- #container { background-color: ~"@{@{color}-md}";
- p { color: ~"@{@{color}-md}"; }
- }
- }
- }
- .setColor("red"); // Quotes, or the value is parsed as "#FF0000" instead of "red"
- //.setColor("blue"); etc..
- FOOD
- );
- // Will output
- //body.red {
- // background-color: #343;
- //}
- //body.red #container {
- // background-color: #232;
- //}
- //body.red #container p {
- // color: #232;
- //}
Add Comment
Please, Sign In to add comment