Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Update README.md #6

Merged
merged 1 commit into from
Jun 22, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 57 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,71 @@ install: `npm install ccss`

main.coffee:

ccss = require 'ccss'
```coffee
ccss = require 'ccss'

template = require './template.coffee'
css = ccss.compile template
require('fs').writeFileSync 'main.css', css
template = require './template.coffee'
css = ccss.compile template
require('fs').writeFileSync 'main.css', css

#or all at once: ccss.compileFile './template.coffee', 'main.css'
#or all at once: ccss.compileFile './template.coffee', 'main.css'
```

template.coffee:

borderRadius = (str) ->
WebkitBorderRadius: str
MozBorderRadius: str
borderRadius: str

boxShadow = (str) ->
WebkitBoxShadow: str
MozBoxShadow: str
boxShadow: str

module.exports =
form:
input:
padding: '5px'
border: '1px solid'
mixins: borderRadius '5px'
'#id .className': do ->
opaque = 1
translucent = opaque / 2
img:
mixins: [
borderRadius '5px'
boxShadow '5px'
]
opacity: translucent
'img:hover':
opacity: opaque
```coffee
borderRadius = (str) ->
WebkitBorderRadius: str
MozBorderRadius: str
borderRadius: str

boxShadow = (str) ->
WebkitBoxShadow: str
MozBoxShadow: str
boxShadow: str

module.exports =
form:
input:
padding: '5px'
border: '1px solid'
mixins: borderRadius '5px'
'#id .className': do ->
opaque = 1
translucent = opaque / 2
img:
mixins: [
borderRadius '5px'
boxShadow '5px'
]
opacity: translucent
'img:hover':
opacity: opaque
```

main.css:

form input {
padding: 5px;
border: 1px solid;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#id .className img {
opacity: 0.5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 5px;
-moz-box-shadow: 5px;
box-shadow: 5px;
}
#id .className img:hover {
opacity: 1;
}
```css
form input {
padding: 5px;
border: 1px solid;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#id .className img {
opacity: 0.5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 5px;
-moz-box-shadow: 5px;
box-shadow: 5px;
}
#id .className img:hover {
opacity: 1;
}
```

the core of the compiler is simply this:

Expand Down