Permalink
Browse files

Update README for 0.2.0

  • Loading branch information...
1 parent 3b7a6a8 commit b4251a24677684f7f30fd684eb20382941834010 @cdaddr committed Jul 29, 2010
Showing with 51 additions and 3 deletions.
  1. +51 −3 README.markdown
View
@@ -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
@@ -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.
@@ -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.