aboutsummaryrefslogtreecommitdiffstats
path: root/README.rst
blob: 0738c121968e982fb8418b6ecd23db1871fc57a4 (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
PyKSS - Knyle Style Sheets
==========================

.. image:: https://secure.travis-ci.org/seanbrant/pykss.png?branch=master
   :target: http://travis-ci.org/seanbrant/pykss


PyKSS is a Python implementation of KSS_. KSS attempts to provide a
methodology for writing maintainable, documented CSS within a team.

The official docs_ provide a good introduction to KSS. The complete
syntax can he found on the syntax_ page.

.. _KSS: http://warpspire.com/kss
.. _docs: http://warpspire.com/kss/
.. _syntax: http://warpspire.com/kss/syntax/


Installing
----------

.. code-block:: shell

    pip install pykss


Usage
-----

.. code-block:: python

    >>> import pykss
    >>>
    >>> styleguide = pykss.Parser('static/css')
    >>>
    >>> styleguide.section('2.1.1')
    <pykss.section.Section object at 0x10c1d1190>
    >>>
    >>> styleguide.section('2.1.1').description
    'A button suitable for giving stars to someone.'
    >>>
    >>> styleguide.section('2.1.1').modifiers[0]
    <pykss.modifier.Modifier object at 0x10c1d1290>
    >>>
    >>> styleguide.section('2.1.1').modifiers[0].name
    ':hover'
    >>>
    >>> styleguide.section('2.1.1').modifiers[0].class_name
    'pseudo-class-hover'
    >>>
    >>> styleguide.section('2.1.1').modifiers[0].description
    'Subtle hover highlight'


Django Usage
------------
If you would like to use KSS within a Django project `pykss.contrib.django`
provides a view and template tag to make it easier. Check out the example
Django project for usage.