The pythonic awesome stylesheet language
Project description
http://githab.com/rimvaliulin/pass
The pythonic awesome stylesheet language.
About
Pass is a dynamic stylesheet language and css preprocessor for web-developers that makes ccs coding simple and beautiful by having dynamic behavior such as variables, inheritance, operations and functions with python like indented syntax.
Installation
pip install pass
Command-line usage
pass style.pass
Usage in Code
import Pass Pass('style.pass')
Syntax
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system. “DRY - don’t repeat yourself”
There should be one — and preferably only one — obvious way to do it”, from “The Zen of Python”.
Variables and operators
Variables allow you to specify widely used values in a single place, and then re-use them throughout the stylesheet, making global changes as easy as changing one line of code.
// Pass link_active = #1f6ba2 link_hover = #ccc link_height = 32px link_size = 1em .menu-item color link_active line-height link_height / 2 a:hover color link_hover font-size link_size + 0.5 background #000 |
/* Compiled CSS */ .menu-item { color: #1f6ba2; line-height: 16px } a:hover { color: #ccc font-size: 1.5em background: #000 } |
Nested selectors
Rather than constructing long selector names to specify inheritance, you can simply nest selectors inside other selectors.
// Pass line_height = 16px .menu margin-bottom line_height/2 -item float left color #fff :visited color #eee _active :hover color #ccc span background-color #ccc |
/* Compiled CSS */ .menu { margin-bottom 8px } .menu-item { float left color #fff } .menu-item:visited { color #eee } .menu-item_active, .menu-item:hover { color #ccc } .menu span { background-color #ccc } |
Selector inheritance
Class naming scheme:
block-[element] [child_]parent-[[parent]_child]
// Pass ._wrapper pass .wrapper pass .header pass .content pass .footer pass .main pass _header pass _content pass _footer pass .page pass _header pass _content pass _footer pass |
/* Compiled CSS */ ._wrapper pass .wrapper pass .header pass .content pass .footer pass .main pass _header pass _content pass _footer pass .page pass _header pass _content pass _footer pass |
Functions
Command-line options
- -a
Output all.
- -b
Output both (this description is quite long).
- -c arg
Output just arg.
- --long
Output all day long.
- -p
This option has two paragraphs in the description. This is the first.
This is the second. Blank lines may be omitted between options (as above) or left in (as here and below).
- --very-long-option
A VMS-style option. Note the adjustment for the required two spaces.
- --an-even-longer-option
The description can also start on the next line.
- -2, --two
This option has two variants.
- -f FILE, --file=FILE
These two options are synonyms; both have arguments.
- /V
A VMS/DOS-style option.
License
See LICENSE file.
> Copyright (c) 2012 Rim Valiulin
- Author:
Rim Valiulin
- Version:
1.0.0 of 2013/07/21
- Dedication:
To my wife.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.