Skip to content

Commit

Permalink
Update README for 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaddr committed Jul 29, 2010
1 parent 3b7a6a8 commit b4251a2
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# gaka 0.1.0
# gaka 0.2.0
by [Brian Carper](http://briancarper.net)

Gaka is a CSS-generating library for Clojure inspired partly by
Expand Down Expand Up @@ -88,13 +88,56 @@ which lets you have "mixins".
div {
color: red;}

You can also use maps for attributes. Keep in mind that maps are unordered, whereas
order is significant in CSS (attributes can override earlier attributes). To preserve
order, either use "flattened" key/value pairs, or a mixture of map and flattened
versions.

;; WRONG! The order of map keys/values is unpredictable.
;; You may or may not get what you want.
user> (println (gaka/css [:a {:border 0 :border-left "1px"}]))
a {
border-left: 1px;
border: 0;}

;; OK
user> (println (gaka/css [:a :border 0 :border-left "1px"]))
a {
border: 0;
border-left: 1px;}

;; OK
user> (println (gaka/css [:a (list :border 0 :border-left "1px")]))
a {
border: 0;
border-left: 1px;}

;; OK
user> (println (gaka/css [:a :border 0 {:border-left "1px"}]))
a {
border: 0;
border-left: 1px;}

;; OK
user> (println (gaka/css [:a {:border 0} {:border-left "1px"}]))
a {
border: 0;
border-left: 1px;}

If you want a fancy selector or attribute that doesn't work as a keyword, use a
string.

user> (println (gaka/css ["input[type=text]" :font-family "\"Bitstream Vera Sans\", monospace"]))
input[type=text] {
font-family: "Bitstream Vera Sans", monospace;}

If you want output suitable for inline CSS, use `inline-css`:

user> (println (str "<div style=\""
(gaka/inline-css :color :red)
"\">foo</div>"))
<div style="color: red;">foo</div>

An easy way to compile your CSS to a file and make sure it's always up-to-date
is to throw a `save-css` call at the bottom of your source file.

Expand Down Expand Up @@ -122,15 +165,20 @@ Gaka doesn't validate your CSS or check your spelling.
Gaka makes no attempt to be fast. You should compile your CSS, save it to a
file and serve it statically.

I wrote this in one afternoon while eating a tasty ham and turky sandwich.
I wrote (most of) this in one afternoon while eating a tasty ham and turky sandwich.
Bugs are likely.

## Install

To fetch from CLojars (via Leiningen) put this in your project.clj:

[gaka "0.1.0"]
[gaka "0.2.0"]

## License

Eclipse Public License 1.0, see http://opensource.org/licenses/eclipse-1.0.php.

## Thanks

[Steve Purcell](http://github.com/purcell) for map syntax and inline CSS.

0 comments on commit b4251a2

Please sign in to comment.