Python LESS Compiler.
A compiler written in Python for the LESS language. For those of us not willing or able to have node.js installed in our environment. Not all features of LESS are supported (yet). Some features wil probably never be supported (JavaScript evaluation). This program uses PLY (Python Lex-Yacc) to tokenize / parse the input and is considerably slower than the NodeJS compiler. The plan is to utilize this to build in proper syntax checking and perhaps YUI compressing.
This is an early version, so you are likely to find bugs.
To install lesscpy from the Python Package Index, simply:
To do a local system-wide install:
Or simply place the package into your Python path. Or rather use packages provided by your distribution (openSUSE has them at least).
usage: lesscpy [-h] [-v] [-I INCLUDE] [-V] [-C] [-x] [-X] [-t] [-s SPACES] [-o OUT] [-r] [-f] [-m] [-D] [-g] [-S] [-L] [-N] target [output] LessCss Compiler positional arguments: target less file or directory output output file path optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -I INCLUDE, --include INCLUDE Included less-files (comma separated) -V, --verbose Verbose mode -C, --dont_create_dirs Creates directories when outputing files (lessc non- compatible) Formatting options: -x, --minify Minify output -X, --xminify Minify output, no end of block newlines -t, --tabs Use tabs -s SPACES, --spaces SPACES Number of startline spaces (default 2) Directory options: Compiles all *.less files in directory that have a newer timestamp than it's css file. -o OUT, --out OUT Output directory -r, --recurse Recursive into subdirectorys -f, --force Force recompile on all files -m, --min-ending Add '.min' into output filename. eg, name.min.css -D, --dry-run Dry run, do not write files Debugging: -g, --debug Debugging information -S, --scopemap Scopemap -L, --lex-only Run lexer on target -N, --no-css No css output << jtm@robot.is @_o >>
If you want to use the compiler from within Python, you can do it like this:
import lesscpy print(lesscpy.compile(StringIO(u"a { border-width: 2px * 3; }"), minify=True))
The output will be:
a{border-width:6px;}
See the LICENSE file
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4