All Projects → lesscpy → Lesscpy

lesscpy / Lesscpy

Licence: mit
Python LESS compiler

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Lesscpy

Vbuild
"Compile" your VueJS components (sfc/*.vue) to standalone html/js/css ... python only (no need of nodejs). Support python components too !
Stars: ✭ 236 (+77.44%)
Mutual labels:  compiler, less
Tinyscript
自制的一个编译器, 用于学习,完整实现了词法分析,语法分析,中间代码(SSA)生成,机器码生成,和基于寄存器的虚拟机
Stars: ✭ 132 (-0.75%)
Mutual labels:  compiler
Prettydiff
Beautifier and language aware code comparison tool for many languages. It also minifies and a few other things.
Stars: ✭ 1,635 (+1129.32%)
Mutual labels:  less
Vscode Deploy Reloaded
Recoded version of Visual Studio Code extension 'vs-deploy', which provides commands to deploy files to one or more destinations.
Stars: ✭ 129 (-3.01%)
Mutual labels:  less
Asterius
A Haskell to WebAssembly compiler
Stars: ✭ 1,799 (+1252.63%)
Mutual labels:  compiler
Ocaml Protoc
A Protobuf Compiler for OCaml
Stars: ✭ 129 (-3.01%)
Mutual labels:  compiler
Bootstrap 3 Arabic
bootstrap 3 arabic
Stars: ✭ 124 (-6.77%)
Mutual labels:  less
Ng Packagr
Compile and package Angular libraries in Angular Package Format (APF)
Stars: ✭ 1,730 (+1200.75%)
Mutual labels:  less
Fonts
Free and open fonts for the Atom editor
Stars: ✭ 131 (-1.5%)
Mutual labels:  less
Pl0 Compiler
Compiler written for PL0 programming Language. Written in C, for COP3402 class from UCF.
Stars: ✭ 128 (-3.76%)
Mutual labels:  compiler
Md
A markdown parser and compiler. Built for speed.
Stars: ✭ 128 (-3.76%)
Mutual labels:  compiler
Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: ✭ 126 (-5.26%)
Mutual labels:  less
Jphp
JPHP - an implementation of PHP on Java VM
Stars: ✭ 1,665 (+1151.88%)
Mutual labels:  compiler
Vue2 Manage
基于 vue + element-ui 的后台管理系统
Stars: ✭ 11,345 (+8430.08%)
Mutual labels:  less
Naskah
Bahasa pemrograman dengan sintaks Bahasa Indonesia (Programming language with Indonesian syntax) 🇮🇩
Stars: ✭ 132 (-0.75%)
Mutual labels:  compiler
Cperl
A perl5 with classes, types, compilable, company friendly, security
Stars: ✭ 125 (-6.02%)
Mutual labels:  compiler
Grain
The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
Stars: ✭ 2,199 (+1553.38%)
Mutual labels:  compiler
Markdown Resume
Generate a responsive CSS3 and HTML5 resume with Markdown, with optional PDF output.
Stars: ✭ 1,659 (+1147.37%)
Mutual labels:  less
Hivemind
a multi-syntax language
Stars: ✭ 133 (+0%)
Mutual labels:  compiler
Solang
First fully featured programming language for Stack Overflow Driven Development
Stars: ✭ 133 (+0%)
Mutual labels:  compiler

LESSCPY

.. image:: https://travis-ci.org/lesscpy/lesscpy.png?branch=master :target: https://travis-ci.org/lesscpy/lesscpy

.. image:: https://coveralls.io/repos/lesscpy/lesscpy/badge.png :target: https://coveralls.io/r/lesscpy/lesscpy

.. image:: https://img.shields.io/pypi/dm/lesscpy.svg :target: https://pypi.python.org/pypi/lesscpy

.. image:: https://img.shields.io/pypi/v/lesscpy.svg :target: https://pypi.python.org/pypi/lesscpy

.. image:: https://img.shields.io/pypi/wheel/lesscpy.svg :target: https://pypi.python.org/pypi/lesscpy :alt: Wheel Status

.. image:: https://img.shields.io/pypi/l/lesscpy.svg :target: https://pypi.python.org/pypi/lesscpy :alt: License

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.

For more information on LESS: http://lesscss.org/ or https://github.com/cloudhead/less.js

Development files: https://github.com/lesscpy/lesscpy

Supported features

  • Variables
  • String interpolation
  • Mixins (nested, calls, closures, recursive)
  • Guard expressions
  • Parametered mixins (class / id)
  • @arguments
  • Nesting
  • Escapes ~/e()
  • Expressions
  • Keyframe blocks
  • Color functions (lighten, darken, saturate, desaturate, spin, hue, mix, saturation, lightness)
  • Other functions (round, increment, decrement, format '%(', ...)

Differences from less.js

  • All colors are auto-formatted to #nnnnnn. eg, #f7e923
  • Does not preserve CSS comments

Not supported

  • JavaScript evaluation

Requirements

  • Python 2.7, 3.4, 3.5, 3.6 or 3.7
  • ply (Python Lex-Yacc) (check requirements.txt)
  • six

Installation

To install lesscpy from the Python Package Index_, simply:

.. code-block:: bash

$ pip install lesscpy

To do a local system-wide install:

.. code-block:: bash

python setup.py install

Or simply place the package into your Python path. Or rather use packages provided by your distribution (openSUSE has them at least).

Compiler script Usage

.. code-block:: text

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

<< [email protected] @_o >>

Python usage

If you want to use the compiler from within Python, you can do it like this:

.. code-block:: python

import lesscpy
from six import StringIO

print(lesscpy.compile(StringIO(u"a { border-width: 2px * 3; }"), minify=True))

The output will be:

.. code-block:: text

a{border-width:6px;}

License

See the LICENSE file

.. _Python Package Index: https://pypi.python.org/pypi/lesscpy

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].