Download the PHP package icit/wp-less without Composer

On this page you can find all versions of the php package icit/wp-less. 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 wp-less

Enable LESS CSS in WordPress

LESS is an abstraction layer that adds some very powerful features to CSS. It will speed up your development process and make your life that much easier. Find out more from the links below and then head on back.

The addon allows you to write and edit .less files directly and have WordPress do the job of compiling and caching the resulting CSS. It eliminates the extra step of having to compile the .less files into CSS yourself before deploying them.

Installation:

If you are using git to clone the repository, do the following:

git clone git://github.com/sanchothefat/wp-less.git wp-less

If you are downloading the .zip or .tar, don't forget to download the lessphp dependency too and copy it into the vendor/leafo/lessphp directory.

Then install the lessphp dependency using:

composer install

Alternatively, add "icit/wp-less" as a requirement to your composer.json, and add this git repository e.g.:

{
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/sanchothefat/wp-less.git"
        }
    ],
    "require": {
        "icit/wp-less": "dev-master"
    }
}

Usage:

You can either install the script as a standard plugin or use it as an include within a theme or plugin.

For use with themes add the following lines to your functions.php:

Any registered styles with the .less suffix will be compiled and the file URL rewritten.

You won't need a link to your main style sheet in header.php. Just make sure that wp_head() is called in the document head.

All the standard LESS features are supported as well as @import rules anywhere within the file.

Passing in variables from PHP

You can pass variables into your .less files using the less_vars hook or with the functions defined in the PHP Interface section:

Within your .less files you can use the variable as if you had declared it in the stylesheet. For e.g.:

Default variables

There are 2 default variables you can use without worrying about the above code:

@themeurl is the URL of the current theme directory:

*@lessurl** is the URL of the enqueued LESS file (this does not change inside imported files):

@lessurl is useful in those cases where you have .less files inside plugins or other non theme folder locations.

It is important to use these because you can't use relative paths - the compiled CSS is stored in the uploads folder as it is the only place you can guarantee being able to write to in any given WordPress installation. As a result relative URLs will break.

PHP interface

register_less_function() allows you to create additional less compiler functions for use in your stylesheet without having to touch the lessc class yourself.

unregister_less_function() works in a similar way but unregisters any compiler functions passed to it by name.

add_less_var() makes it easy to create or modify variables passed into the compiler. Both arguments should be a string, as lessc will work out the type of variable it is.

remove_less_var() is the inverse of add_less_var() and only requires the variable name to remove.

Further Reading

Read the LESS.js documentation here.

Read the documentation specific to the PHP parser here.

Contributors

Big massive thanks to those whose contributions and discussion has helped to improve the plugin.

License

The software is licensed under the MIT Licence.


All versions of wp-less with dependencies

PHP Build Version
Package Version
Requires php Version >5.2.4
composer/installers Version ~1.0
leafo/lessphp Version 0.4.0
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 icit/wp-less contains the following files

Loading the files please wait ....