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.