cypresslab / less-elephant
A library to manage a less project with PHP
Installs: 5 862
Dependents: 3
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.3
- symfony/finder: >=2.0,<2.4-dev
- symfony/process: >=2.0,<2.4-dev
Requires (Dev)
- phpunit/phpunit: @stable
This package is auto-updated.
Last update: 2024-10-29 08:06:18 UTC
README
A wrapper for the less binary written in PHP
Requirements
- php >= 5.3
- *nix system with less (lessc binary) installed
Dependencies
for tests
Installation
composer
To install LessElephant with composer you simply need to create a composer.json in your project root and add:
{ "require": { "cypresslab/less-elephant": "<=1.0.0" } }
Then run
$ wget -nc http://getcomposer.org/composer.phar $ php composer.phar install
You have now LessElephant installed in vendor/cypresslab/lesselephant
And an handy autoload file to include in you project in vendor/.composer/autoload.php
pear
Add the Cypresslab channel
$ pear channel-discover pear.cypresslab.net
And install the package. By now LessElephant is in alpha state. So remember the -alpha in the library name
$ pear install cypresslab/LessElephant-alpha
On Cypresslab pear channel homepage you can find other useful information
Testing
The library is tested with PHPUnit.
Go to the base library folder and run the test suites
$ phpunit
Code style
- LessElephant follows the Symfony2 Coding Standard
- I'm using gitflow so, if you want to contribute, please send a pull-request on develop branch
How to use
Remember to give the user the right permissions to access the filesystem. If you are using a web server give permissions to both your user and the web server user.
constructor
<?php $project = new LessProject("/path/to/less/folder", "screen.less", "/path/to/css/screen.css"); // create the base class // optionally you can pass a project name and a custom LessBinary class $project = new LessProject( "/path/to/less/folder", "main_file.less", "/path/to/css/file.css", "my-awesome-project", new LessBinary("/path/to/lessc") );
manage a less project
// return false if the project needs to be recompiled. In other words if you changed something in any of your less files after the last sylesheets generation if (!$project->isClean()) { $project->compile(); // compile the project } echo $project->isClean(); // returns true
Staleness Checker
LessElephant checks if the project need to be compiled with the awesome Symfony Finder component, by scanning your source less folder
Symfony2
LessElephantBundle let symfony do the work for you