The dynamic stylesheet language. For more info about the language see the offical website: http://lesscss.org
ILess is a PHP port of the official LESS processor written in Javascript. Most of the code structure remains the same, which should allow for fairly easy updates in the future.
To use ILess in your project you can:
- Install it using Composer (more info on Packagist)
- Download the latest release
- Clone the repository:
git clone git://github.com/mishal/iless.git
To run ILess you need:
PHP >= 5.2
(yes, you read right)bcmath
extension installed
- Allows to register custom file importers (from database, ...)
- Allows to setup import directories so search imports for
- Allows to define custom LESS functions with PHP callbacks
- Generates source maps (usefull for debugging the generated CSS)
- Generates debugging information with SASS compatible information and/or simple comments
- Supports output filters
- Allows caching of the precompiled files
- Is unit tested using PHPUnit
- Has well documented API - see the generated API docs.
For example usage check the examples
folder in the source files.
<?php
// setup autoloading
// 1) when installed with composer
require 'vendor/autoload.php';
// 2) when installed manually
// require_once 'lib/ILess/Autoloader.php';
// ILess_Autoloader::register();
$parser = new ILess_Parser(array(
// array of options
// import dirs are search first
'import_dirs' => array(
// PHP 5.2
// dirname(__FILE__) . '/less/import'
__DIR__ . '/less/import'
))
);
// parses the file
$parser->parseFile('screen.less');
// parse string
$parser->parseString('body { color: @color; }');
// assign variables via the API
$parser->setVariables(array(
'color' => '#000000'
));
// Add a custom function
$parser->addFunction('superdarken', function(\ILess_FunctionRegistry $registry, \ILess_Node_Color $color) {
return $registry->call('darken', [$color, new \Iless_Node_Dimension(80, '%')]);
});
$css = $parser->getCSS();
To compile the LESS files (or input from stdin
) you can use the CLI script (located in bin
directory).
Parse the my.less
and save it to my.css
with compression enabled.
$ php bin\iless my.less my.css --compress
Parse input from stdin
and save it to a file my.css
.
$ php bin\iless - my.css
_____ _______ _______ _______
| | |______ |______ |______
__|__ |_____ |______ ______| ______|
usage: iless [option option=parameter ...] source [destination]
If source is set to `-` (dash or hyphen-minus), input is read from stdin.
options:
-h, --help Print help (this message) and exit.
-s, --silent Suppress output of error messages.
-x, --compress Compress output by removing the whitespace.
-a, --append Append the generated CSS to the target file?
--no-ie-compat Disable IE compatibility checks.
--source-map Outputs an inline sourcemap to the generated CSS (or output to filename.map).
--source-map-url The complete URL and filename of the source map to put to the map.
--source-map-base-path Sets sourcemap base path, defaults to current working directory.
-v, --version Print version number and exit.
--dump-line-numbers Outputs filename and line numbers. TYPE can be either 'comments', which will
output the debug info within comments, 'mediaquery' that will output the
information within a fake media query which is compatible with the SASS
format, and 'all' which will do both.
Before opening any issue, please search for existing issues. After that if you find a bug or would like to make feature request, please open a new issue. Please always create a unit test.
The master
branch should contain only stable code, while the develop
branch, as the name suggests, is for development.
Please read contributing guide.
There is a lack of maintanable PHP version of the LESS compiler which would compile the favourite LESS front-end frameworks like Twitter Bootstrap (version 3 and 2).
Why porting the JS version to PHP? Why not? The main reason is to follow new language features with less effort by simly porting the code to PHP.
iless = I less: He must increase, but I must decrease. [John 3:30]
I was born in non believers family and was raised as a atheist. When I was 30 years old my girlfriend came home and said that she is now a Christian and she believes in God! What a shock for me! I thought that she must be totally crazy!
I decided to do a heavy investigation on that topic a bring some proofs to her, that there is no God. I said to myself that I will search without any prejudices no matter what the result will be. In about 1 year I checked the topics which I thought would bring any evidence of God's existence - the science.
I was very suprised to see that there is a plenty of evidence of a design in things around me, even in me. The DNA is a programming language, but a bit complicated than only 1 and 0 that my computer uses. I know that no computer app can just appear or develop by chance even if I will have a rest of 1 billion years.
I came to a revolutionary conclusion for me. God exists! I was 30 year blind!
My girlfriend told me that God loves me and wants a relationship with me. That Jesus died for me and is waiting for my answer to his invitation. I said yes!
Now I'm God's adopted son saved for the eternity. God takes care of me. He freed me from drug addition and other ugly thinks.
I know that God loves to you (is written in his Word) and wants you to save you too. Invite Jesus to your life!
Note: This is not a religion! But a relationship with living God.
- Agree and accept the license which God offers. There is no accept button, but you have to do it by faith. Accept that Jesus died for you and took the punishment instead of you.
- Repent from your sins. Sin is everything that violates the law given by God (not loving God, stealing, cheating, lying... See the full list.
- Ask Jesus for [forgiveness] and to become your personal lord and savior (http://bible.com/37/mrk.2.5-12.ceb).
If you did the steps above with your whole heart you are now a new creation. You belong to God's family and you have now an eternal life. You have been redeemed from the eternal punishment - from the outer darkness where is weeping and gnashing of teeth.
Read the Bible, and ask God to speak with you and to lead you to a (true) Church. There is a lot of so called Churches around, but they to do not teach nor live the Bible. Note: I do not have any connections with Bethel Church.
The work is based on the code by Matt Agar, Martin Jantošovič and Josh Schmidt. Source maps code based on phpsourcemaps by bspot.
All contributors are listed on separate wiki page.