lesspy Documentation

lesspy helps compile collections of LESS files into CSS files

  • Given a source directory, recursively finds LESS (.less/.lss/.css) files
  • Saves compiled CSS files to a destination path, using the same directory structure as the source.

Module Reference

class lesspy.Less(source_path, destination_path, compress=True, compiled_extension='css', less_path='')

Used to automatically parse LESS files through lessc and output CSS.

  • Recursively looks for LESS (.less/.lss/.css) files in source_path
  • Saves compiled CSS files to destination_path, using the same directory structure as the source.

If compress is True, compiled resources will also be minified.

compiled_extension is the file extension used for compiled files, e.g., by default, style.less becomes style.css.

By default, the lessc executable will be searched for on the system path. Optionally, less_path can be used to specify an absolute path to the lessc executable, e.g., "/some/path/to/less"

CSS_RE = <_sre.SRE_Pattern object at 0x7ffb9658fdc8>
compile(files=[])

Compile a list of relative (or absolute) filenames.

When files is None or empty, Less.source_path will be recursively walked and searched for .less, .lss, and .css files to compile.

Returns a list of absolute pathnames of written files, e.g., ['/compiled/path/style.css', '/compiled/path/example.css']

Indices and tables

License

lesspy is licensed under the MIT License.

Copyright (c) 2011 Ryan Petrello

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Table Of Contents

This Page