class bbn\Compilers\Less documentation in

The LESS compiler and parser.

Converting LESS to CSS is a three stage process. The incoming file is parsed by Less_parser into a syntax tree, then it is compiled into another tree representing the CSS structure by Less. The CSS tree is fed into a formatter, like Less_formatter which then outputs CSS as a string.

During the first compile, all values are reduced, which means that their types are brought to the lowest form before being dump as strings. This handles math equations, variable dereferences, and the like.

The parse function of Less is the entry point.

In summary:

The Less class creates an instance of the parser, feeds it LESS code, then transforms the resulting tree to a CSS tree. This class also holds the evaluation context, such as all available mixins and variables at any given time.

The Less_parser class is only concerned with parsing its input.

The Less_formatter takes a CSS tree, and dumps it to a formatted string, handling things like indentation.

The LESS compiler and parser. BBN is a suite of PHP and JS libraries and VueJS components - all open-source!, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.