Code Monkey home page Code Monkey logo

less.php's Introduction

Packagist

Less.php

This is a PHP port of the official LESS processor.

About

The code structure of Less.php mirrors that of upstream Less.js to ensure compatibility and help reduce maintenance. The port is currently compatible with Less.js 2.5.3. Please note that "inline JavaScript expressions" (via eval or backticks) are not supported.

Installation

You can install the library with Composer or standalone.

If you have Composer installed:

  1. Run composer require wikimedia/less.php
  2. Use Less_Parser in your code.

Or standalone:

  1. Download Less.php and upload the PHP files to your server.
  2. Include the library:
    require_once '[path to]/less.php/lib/Less/Autoloader.php';
    Less_Autoloader::register();
  3. Use Less_Parser in your code.

Security

The LESS processor language is powerful and includes features that may read or embed arbitrary files that the web server has access to, and features that may be computationally exensive if misused.

In general you should treat LESS files as being in the same trust domain as other server-side executables, such as PHP code. In particular, it is not recommended to allow people that use your web service to provide arbitrary LESS code for server-side processing.

See also SECURITY.

Who uses Less.php?

Integrations

Less.php has been integrated with various other projects.

Transitioning from Leafo/lessphp

If you're looking to transition from the Leafo/lessphp library, use the lessc.inc.php adapter file that comes with Less.php.

This allows Less.php to be a drop-in replacement for Leafo/lessphp.

Download Less.php, unzip the files into your project, and include its lessc.inc.php instead.

Note: The setPreserveComments option is ignored. Less.php already preserves CSS block comments by default, and removes LESS inline comments.

Drupal

Less.php can be used with Drupal's less module via the lessc.inc.php adapter. Download Less.php and unzip it so that lessc.inc.php is located at sites/all/libraries/lessphp/lessc.inc.php, then install the Drupal less module as usual.

WordPress

  • wp_enqueue_less is a Composer package for use in WordPress themes and plugins. It provides a wp_enqueue_less() function to automatically manage caching and compilation on-demand, and loads the compressed CSS on the page.
  • JBST framework bundles a copy of Less.php.
  • The lessphp plugin bundles a copy of Less.php for use in other plugins or themes. This dependency can also be combined with the TGM Library.

Credits

Less.php was originally ported to PHP in 2011 by Matt Agar and then updated by Martin Jantošovič in 2012. From 2013 to 2017, Josh Schmidt lead development of the library. Since 2019, the library is maintained by Wikimedia Foundation.

Contribute

less.php's People

Contributors

oyejorge avatar krinkle avatar paladox avatar jdforrester avatar agar avatar maxsem avatar asenar avatar mordred avatar thiemowmde avatar polishdeveloper avatar nodge avatar reedy avatar dkrnl avatar mlocati avatar umherirrender avatar rummik avatar ravisorg avatar pafnuty avatar zghosts avatar dannys712 avatar phrozenbyte avatar adrianbadarau avatar nyordanov avatar fabrizim avatar lduer avatar storeman avatar vburlak avatar bertmert avatar s7eph4n avatar scrutinizer-auto-fixer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.