Download the PHP package kylekatarnls/less.php without Composer

On this page you can find all versions of the php package kylekatarnls/less.php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package less.php

Less.php

This is a PHP port of the official LESS processor http://lesscss.org. Build Status

About

The code structure of less.php mirrors that of the official processor which helps us ensure compatibility and allows for easy maintenance.

Please note, there are a few unsupported LESS features:

Installation

You can install the library with composer or manually.

Composer

Step 1. Edit your composer.json:

Step 2. Install it:

Manually From Release

Step 1. Download the latest release and upload the php files to your server.

Step 2. Include the library:

Manually From Source

Step 1. Download the source and upload the files in /lib/Less to a folder on your server.

Step 2. Include the library and register the Autoloader

Basic Use

Parsing Strings

Parsing Less Files

The parseFile() function takes two arguments:

  1. The absolute path of the .less file to be parsed
  2. The url root to prepend to any relative image or @import urls in the .less file.

Handling Invalid Less

An exception will be thrown if the compiler encounters invalid less

Parsing Multiple Sources

less.php can parse multiple sources to generate a single css file

Getting Info About The Parsed Files

less.php can tell you which .less files were imported and parsed.

Compressing Output

You can tell less.php to remove comments and whitespace to generate minimized css files.

Getting Variables

You can use the getVariables() method to get an all variables defined and their value in a php associative array. Note than less have to be previously compiled

Setting Variables

You can use the ModifyVars() method to customize your css if you have variables stored in php associative arrays

Import Directories

By default, less.php will look for @imports in the directory of the file passed to parsefile(). If you're using parse() or if @imports reside in different directories, you can tell less.php where to look.

Caching

Compiling less code into css is a time consuming process, caching your results is highly recommended.

Caching CSS

Use the Less_Cache class to save and reuse the results of compiled less files. This method will check the modified time and size of each less file (including imported files) and regenerate a new css file when changes are found. Note: When changes are found, this method will return a different file name for the new cached content.

Caching CSS With Variables

Passing options to Less_Cache::Get()

Parser Caching

less.php will save serialized parser data for each .less file if a writable folder is passed to the SetCacheDir() method. Note: This feature only caches intermediate parsing results to improve the performance of repeated css generation. Your application should cache any css generated by less.php.

You can specify the caching technique used by changing the option. Supported methods are:

Source Maps

Less.php supports v3 sourcemaps

Inline

The sourcemap will be appended to the generated css file.

Saving to Map File

Command line

An additional script has been included to use the compiler from the command line. In the simplest invocation, you specify an input file and the compiled css is written to standard out:

By using the -w flag you can watch a specified input file and have it compile as needed to the output file:

Errors from watch mode are written to standard out.

For more help, run lessc --help

Integration with other projects

Drupal 7

This library can be used as drop-in replacement of lessphp to work with Drupal 7 less module.

How to install:

  1. Download the less.php source code and unzip it so that 'lessc.inc.php' is located at 'sites/all/libraries/lessphp/lessc.inc.php'.
  2. Download and install Drupal 7 less module as usual.
  3. That's it :)

JBST WordPress theme

JBST has a built-in LESS compiler based on lessphp. Customize your WordPress theme with LESS.

How to use / install:

  1. Download the latest release copy the files to your {wordpress/}wp-content/themes folder and activate it.
  2. Find the compiler under Appearance > LESS Compiler in your WordPress dashboard
  3. Enter your LESS code in the text area and press (re)compile

Use the built-in compiler to:

The compiler can also be download as plugin

WordPress

This simple plugin will simply make the library available to other plugins and themes and can be used as a dependency using the TGM Library

How to install:

  1. Install the plugin from your WordPress Dashboard: http://wordpress.org/plugins/lessphp/
  2. That's it :)

Transitioning from Leafo/lessphp

Projects looking for an easy transition from leafo/lessphp can use the lessc.inc.php adapter. To use, Download the less.php source code and unzip the files into your project so that the new 'lessc.inc.php' replaces the existing 'lessc.inc.php'.

Note, the 'setPreserveComments' will no longer have any effect on the compiled less.

Credits

less.php was originally ported to php by Matt Agar and then updated by Martin Jantošovič.


All versions of less.php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kylekatarnls/less.php contains the following files

Loading the files please wait ....