Fork me on GitHub
#cursive
<
2016-10-28
>
tap08:10:11

I don’t know if it’s the best way, but it works well for me. Few things I did differently from that wiki and it still works: - I use latest version for all the dependencies - I don’t need to remove lein-fighweel from :plugins as it suggests

denik19:10:09

@cfleming I’d like to suggest a better way to indent code:

(def current-ugly-indent
  [:.vims-list {:position      :absolute
                :margin-top    :25px
                :margin-left   :-400px
                :padding       :20px
                :background    :lightgrey
                :border-radius :5px}
   [:.container
    [:&:after {:position      :absolute
               :top           :-5px
               :left          :9px
               :border-bottom "5px solid black"
               :border-right  "5px solid transparent"
               :border-left   "5px solid transparent"
               :content       "''"
               :line-height   0
               :font-size     0}]
    [:.title]
    [:.list {:display        :flex
             :flex-direction :column
             :overflow-y     :scroll}
     [:.row {:display    :flex
             :margin-top :10px}
      [:&:first-child {:margin-top 0}]]]]])

(def pretty-indent
  [:.vims-list        {:position       :absolute
                       :margin-top     :25px
                       :margin-left    :-400px
                       :padding        :20px
                       :background     :lightgrey
                       :border-radius  :5px}
   [:.container
    [:&:after         {:position      :absolute
                       :top           :-5px
                       :left          :9px
                       :border-bottom "5px solid black"
                       :border-right  "5px solid transparent"
                       :border-left   "5px solid transparent"
                       :content       "''"
                       :line-height   0
                       :font-size     0}]
    [:.title]
    [:.list           {:display        :flex
                       :flex-direction :column
                       :overflow-y     :scroll}
     [:.row           {:display    :flex
                       :margin-top :10px}
      [:&:first-child {:margin-top 0}]]]]])

denik19:10:00

This is about aligning not only pairs in relation to their neighbors (like let), but neighbor's children in relation to each other.

denik19:10:19

another example:

;; ugly
(let [props     {:slices         (:vims.derived/slices vims)
                 :playback-speed playback-speed}
      callbacks {:on-play  #(.play this)
                 :on-pause #(.pause this)}])

;; VS

;; pretty
(let [props     {:slices         (:vims.derived/slices vims)
                 :playback-speed playback-speed}
      callbacks {:on-play        #(.play this)
                 :on-pause       #(.pause this)}])