lesscpy


Namelesscpy JSON
Version 0.15.1 PyPI version JSON
download
home_pagehttps://github.com/lesscpy/lesscpy
SummaryPython LESS compiler
upload_time2022-10-21 11:39:14
maintainer
docs_urlNone
authorJóhann T Maríusson
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements ply
Travis-CI
coveralls test coverage No coveralls.
            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 3.7 - 3.11,
- 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

    << jtm@robot.is @_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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lesscpy/lesscpy",
    "name": "lesscpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "J\u00f3hann T Mar\u00edusson",
    "author_email": "jtm@robot.is",
    "download_url": "https://files.pythonhosted.org/packages/9f/e4/a0aad58ca8e755a8192c975163847a1b712a7a6130b087248be24c07a316/lesscpy-0.15.1.tar.gz",
    "platform": null,
    "description": "LESSCPY\n=======\n\n.. image:: https://travis-ci.org/lesscpy/lesscpy.png?branch=master\n        :target: https://travis-ci.org/lesscpy/lesscpy\n\n.. image:: https://coveralls.io/repos/lesscpy/lesscpy/badge.png\n        :target: https://coveralls.io/r/lesscpy/lesscpy\n\n.. image:: https://img.shields.io/pypi/dm/lesscpy.svg\n        :target: https://pypi.python.org/pypi/lesscpy\n\n.. image:: https://img.shields.io/pypi/v/lesscpy.svg\n        :target: https://pypi.python.org/pypi/lesscpy\n\n.. image:: https://img.shields.io/pypi/wheel/lesscpy.svg\n        :target: https://pypi.python.org/pypi/lesscpy\n        :alt: Wheel Status\n\n.. image:: https://img.shields.io/pypi/l/lesscpy.svg\n        :target: https://pypi.python.org/pypi/lesscpy\n        :alt: License\n\nPython LESS Compiler.\n\nA compiler written in Python for the LESS language. For those of us not willing\nor able to have node.js installed in our environment. Not all features of LESS\nare supported (yet). Some features wil probably never be supported (JavaScript\nevaluation). This program uses PLY (Python Lex-Yacc) to tokenize / parse the\ninput and is considerably slower than the NodeJS compiler. The plan is to\nutilize this to build in proper syntax checking and perhaps YUI compressing.\n\nThis is an early version, so you are likely to find bugs.\n\nFor more information on LESS:\n  http://lesscss.org/ or https://github.com/cloudhead/less.js\n \nDevelopment files:\n  https://github.com/lesscpy/lesscpy\n\n\nSupported features\n------------------\n\n- Variables\n- String interpolation\n- Mixins (nested, calls, closures, recursive)\n- Guard expressions\n- Parametered mixins (class / id)\n- @arguments\n- Nesting\n- Escapes ~/e()\n- Expressions\n- Keyframe blocks\n- Color functions (lighten, darken, saturate, desaturate, spin, hue, mix,\n                   saturation, lightness)\n- Other functions (round, increment, decrement, format '%(', ...)\n\n\nDifferences from less.js\n------------------------\n\n- All colors are auto-formatted to #nnnnnn. eg, #f7e923\n- Does not preserve CSS comments\n\n\nNot supported\n-------------\n\n- JavaScript evaluation\n \n\nRequirements\n------------\n\n- Python 3.7 - 3.11,\n- ply (Python Lex-Yacc) (check requirements.txt)\n- six\n\nInstallation\n------------\n\nTo install lesscpy from the `Python Package Index`_, simply:\n\n.. code-block:: bash\n\n    $ pip install lesscpy\n\nTo do a local system-wide install:\n\n.. code-block:: bash\n\n    python setup.py install\n \nOr simply place the package into your Python path. Or rather use packages\nprovided by your distribution (openSUSE has them at least).\n\n\nCompiler script Usage\n---------------------\n \n.. code-block:: text\n\n    usage: lesscpy [-h] [-v] [-I INCLUDE] [-V] [-C] [-x] [-X] [-t] [-s SPACES]\n                   [-o OUT] [-r] [-f] [-m] [-D] [-g] [-S] [-L] [-N]\n                   target [output]\n\n    LessCss Compiler\n\n    positional arguments:\n      target                less file or directory\n      output                output file path\n\n    optional arguments:\n      -h, --help            show this help message and exit\n      -v, --version         show program's version number and exit\n      -I INCLUDE, --include INCLUDE\n                            Included less-files (comma separated)\n      -V, --verbose         Verbose mode\n      -C, --dont_create_dirs\n                            Creates directories when outputing files (lessc non-\n                            compatible)\n\n    Formatting options:\n      -x, --minify          Minify output\n      -X, --xminify         Minify output, no end of block newlines\n      -t, --tabs            Use tabs\n      -s SPACES, --spaces SPACES\n                            Number of startline spaces (default 2)\n\n    Directory options:\n      Compiles all *.less files in directory that have a newer timestamp than\n      it's css file.\n\n      -o OUT, --out OUT     Output directory\n      -r, --recurse         Recursive into subdirectorys\n      -f, --force           Force recompile on all files\n      -m, --min-ending      Add '.min' into output filename. eg, name.min.css\n      -D, --dry-run         Dry run, do not write files\n\n    Debugging:\n      -g, --debug           Debugging information\n      -S, --scopemap        Scopemap\n      -L, --lex-only        Run lexer on target\n      -N, --no-css          No css output\n\n    << jtm@robot.is @_o >>\n\nPython usage\n------------\n\nIf you want to use the compiler from within Python, you can do it like this:\n\n.. code-block:: python\n\n    import lesscpy\n    from six import StringIO\n\n    print(lesscpy.compile(StringIO(u\"a { border-width: 2px * 3; }\"), minify=True))\n\nThe output will be:\n\n.. code-block:: text\n\n    a{border-width:6px;}\n\nLicense\n-------\n\nSee the LICENSE file\n\n\n.. _`Python Package Index`: https://pypi.python.org/pypi/lesscpy\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python LESS compiler",
    "version": "0.15.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "97044b2235c7241df8a57a23d954959a",
                "sha256": "8d26e58ed4812b345c2896daea435a28cb3182f87ae3391157085255d4c37dff"
            },
            "downloads": -1,
            "filename": "lesscpy-0.15.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "97044b2235c7241df8a57a23d954959a",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 46702,
            "upload_time": "2022-10-21T11:36:56",
            "upload_time_iso_8601": "2022-10-21T11:36:56.742109Z",
            "url": "https://files.pythonhosted.org/packages/2a/da/4a20ba69c9c71ce3d522da5a3c617254d1d1430b71f52b7d46dbf2c06b96/lesscpy-0.15.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "a86f641cbf13ae263de34ba74d20cf9e",
                "sha256": "1045d17a98f688646ca758dff254e6e9c03745648e051a081b0395c3b77c824c"
            },
            "downloads": -1,
            "filename": "lesscpy-0.15.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a86f641cbf13ae263de34ba74d20cf9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 177240,
            "upload_time": "2022-10-21T11:39:14",
            "upload_time_iso_8601": "2022-10-21T11:39:14.247353Z",
            "url": "https://files.pythonhosted.org/packages/9f/e4/a0aad58ca8e755a8192c975163847a1b712a7a6130b087248be24c07a316/lesscpy-0.15.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-10-21 11:39:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "lesscpy",
    "github_project": "lesscpy",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "ply",
            "specs": []
        }
    ],
    "tox": true,
    "lcname": "lesscpy"
}
        
Elapsed time: 0.02239s