summaryrefslogtreecommitdiff
path: root/docs/usage.rst
blob: 65b53792a3405683aac0eef6d187bd1e6f798aa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Installation and usage
======================

Installation
------------

pyScss requires only Python 2.6 or later, including Python 3.x.  PyPy is also
known to work.  Install with pip::

    pip install pyScss

It has a handful of pure-Python dependencies, which pip should install for you:

* ``six``
* ``enum34`` (for Python 3.3 and below)
* ``pathlib`` (for Python 3.3 and below)

There's also an optional C speedup module, which requires having ``libpcre``
and its development headers installed, with UTF-8 support enabled (which it is
by default).


Usage
-----

Run from the command line by using ``-m``::

    python -m scss < file.scss

Specify directories to search for imports with ``-I``.  See ``python -mscss
--help`` for more options.

.. note::

    ``-mscss`` will only work in Python 2.7 and above.  In Python 2.6, ``-m``
    doesn't work with packages, and you need to invoke this instead::

        python -m scss.tool



Interactive mode
----------------

To get a REPL::

    python -mscss --interactive

Example session::

    $ python scss.py --interactive
    >>> @import "compass/css3"
    >>> show()
    ['functions', 'mixins', 'options', 'vars']
    >>> show(mixins)
    ['apply-origin',
        'apply-transform',
        ...
        'transparent']
    >>> show(mixins, transparent)
    @mixin transparent() {
        @include opacity(0);
    }
    >>> 1px + 5px
    6px
    >>> _


Compass example
---------------

With ``--load-path`` set to Compass and Blueprint roots, you can compile with
Compass like with the following::

    @option compress: no;

    $blueprint-grid-columns : 24;
    $blueprint-grid-width   : 30px;
    $blueprint-grid-margin  : 10px;
    $font-color             : #333;

    @import "compass/reset";
    @import "compass/utilities";
    @import "blueprint";

    // your code...