garden icon indicating copy to clipboard operation
garden copied to clipboard

make at-media and similar helpers evaluated later

Open niquola opened this issue 8 years ago • 2 comments

Now when you use at-media in the middle of garden data structure - it starts eager evaluation, so we are loosing data nature of result. It would be cool to make it lazy:

[:body {}
   [at-media {} & rules] ;; (not (at-media)
   [:h3 {:line-height [px 5]}]] ;; (not (px 5))

and evaluate lately in (css)

niquola avatar Sep 25 '15 12:09 niquola

@niquola I'm in agreement. Laziness would be cool. However, I think there is a broader problem (which I've eluded to previously) in that Garden itself doesn't have a data format that's granular enough to represent this sort of thing without the record format it currently uses. Personally, I would rather have an underlying data format that is closer to a parse tree. This would enable the library to be far more flexible.

[:css/rule
 [:css/selector "body"]
 [:css/at-media
  [:css/block
   [:css/rule
    [:css/selector "h3"]
    [:css/block
     [:css/declaration
      [:css/property "line-height"]
      [:css/value
       [:css/comma-separated-list
        [:css/unit
         [:css/number 5]
         [:css/measurement "px"]]]]]]]]]]

noprompt avatar Sep 26 '15 04:09 noprompt

:+1:

niquola avatar Sep 26 '15 07:09 niquola