switched to less.js

This commit is contained in:
Christian Mueller
2014-01-03 22:34:04 +01:00
parent 95db9fb723
commit 22409a1341
7 changed files with 143 additions and 50 deletions
+14 -4
View File
@@ -18,7 +18,8 @@
(defpartial generate-layout
[params title & content]
; for the sake of security: escape all symbols of the param values
(let [params (into {} (for [[k v] params] [k (escape-html v)]))]
(let [params (into {} (for [[k v] params] [k (escape-html v)]))
theme (:theme params "default")]
(html5
[:head
[:title (print-str (get-message :name) "—" title)]
@@ -38,16 +39,25 @@
"&subset=latin,cyrillic") " " "+")
:rel "stylesheet"
:type "text/css"}]
; generating the global CSS
[:link {:rel "stylesheet" :type "text/css" :href "/style.css"}]
[:link {:rel "stylesheet/less" :type "text/css" :href "/style.less"}]
; google analytics code should appear in prod mode only
(if-not (dev-mode?) (include-js "/js/google-analytics.js"))]
[:body content
; we only need JS during a new note creation, so don't render it otherwise
(html
(include-js "/js/less.js")
(include-js "/js/md5.js")
(include-js "/js/marked.js")
(include-js "/js/main.js"))])))
(include-js "/js/main.js")
(include-js "/js/themes.js")
(javascript-tag (str "less.modifyVars({
'@background': themes['" theme "'].background.normal,
'@background_halftone': themes['" theme "'].background.halftone,
'@foreground': themes['" theme "'].foreground.normal,
'@foreground_halftone': themes['" theme "'].foreground.halftone,
'@link_fresh': themes['" theme "'].link.fresh,
'@link_visited': themes['" theme "'].link.visited,
'@link_hover': themes['" theme "'].link.hover});")))])))
(defn layout
"Generates the main html layout"
+4 -4
View File
@@ -78,9 +78,9 @@
[:br]
[:a.landing-button {:href "/new" :style "color: white"} (get-message :new-page)]]
[:div#dashed-line]
[:article.helvetica-neue.bottom-space.markdown {:style "font-size: 1em"}
[:article.helvetica.bottom-space.markdown {:style "font-size: 1em"}
(slurp "LANDING.md")]
[:div.centered.helvetica-neue.markdown (get-message :footer)]))
[:div.centered.helvetica.markdown (get-message :footer)]))
; input form for the markdown text with a preview area
(defpartial input-form [form-url command fields content passwd-msg]
@@ -88,7 +88,7 @@
(layout {:js true} (get-message :new-note)
[:article#preview.markdown " "]
[:div#dashed-line {:class css-class}]
[:div.central-element.helvetica-neue {:style "margin-bottom: 3em"}
[:div.central-element.helvetica {:style "margin-bottom: 3em"}
(form-to {:autocomplete :off} [:post form-url]
(hidden-field :action command)
(hidden-field :password)
@@ -129,7 +129,7 @@
(defpage "/:year/:month/:day/:title/stats" {:keys [year month day title]}
(when-let [views (get-note-views [year month day] title)]
(layout (get-message :statistics)
[:table#stats.helvetica-neue.central-element
[:table#stats.helvetica.central-element
[:tr
[:td (get-message :published)]
[:td (interpose "-" [year month day])]]