So far, I really like Garden.
There's one thing though that's making it difficult. It's hard to see that
nested rules are nested.
;; hard to see nesting[:footer {:color "red"
:background-color "blue"}
[:a {:color "green"}]]
;; much easier(:footer {:color "red"
:background-color "blue"}
[:a {:color "green"}])
(That's a bad example because it's so short. In the real world, much longer
and deeper-nested rules show it clearer.)
Technically I'm using emacs with clojure-mode.el, which indents vectors by
only 1 char. But I don't think that's the problem. Normally it's good to
indent them by only 1 char, but there's no way to differentiate between
[:some [:random :data]], which should be indented like that, and a vector
of garden-rules which should be indented more obviously. So I don't think
this is something that changing our editors/plugins will fix.
One solution is to use
defrule<https://github.com/noprompt/garden/issues/5#issuecomment-19848873>more
often. But if I have 3 elements with 3 children each, and each child
has 3 children, that's already 27 defrules I have to stick above it.
That'll get pretty unruly quick.
So I was thinking of just using a dummy macro like this:
(defmacro rule [& body] `[~@body])
(def footer
(rule :footer {:color "red"
:background-color "blue"}
(rule :a {:color "green"})))
But you can imagine my discomfort at writing/using a macro just to make
indentation easier.
Are there any better solutions to this?
-Steven
On Tue, Apr 9, 2013 at 2:58 PM, Joel Holdbrooks <[email protected]>wrote:
> Nobel Clojurians,
>
> I am pleased to announce the alpha version of
> *Garden*<https://github.com/noprompt/garden>,
> a new library for writing CSS in Clojure.
>
> The project weds the best ideas from Hiccup, gaka, and cssgen and aims to
> provide a clean and conventional way to author stylesheets without being
> too simple or too complex.
>
> Currently the list of notable features include:
>
> - Nestable rules
> - Nestable declarations (this my change)
> - A builtin set of tools for working with CSS unit values
> - Convenient multiple selector syntax (IE. h1, h2, h3 { ... })
> - Output formatting options
>
> What's planned for the near future:
>
> - The ability to use Clojure meta as a media query
> - A builtin set of tools for working with CSS color values
> - & selector syntax for nested rules
>
> For those of you who are interested in this sort of thing, please have a
> look at the *project's repository* <https://github.com/noprompt/garden>.
> There is still quite a bit of ground to do cover and any
> help/criticism/contribution would be greatly appreciated.
>
> Please feel free to offer suggestions, ask questions, open issues, or send
> pull requests. I would love nothing more than to see this library succeed
> where other's have not.
>
>
> Truly,
>
> Joel Holdbrooks (aka noprompt)
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.