This commit is contained in:
lacarmen 2014-12-31 16:55:29 -05:00
parent b8c5b71dbb
commit 73338935fa

View file

@ -184,12 +184,11 @@
(render-file "templates/html/layouts/page.html" (render-file "templates/html/layouts/page.html"
(merge default-params (merge default-params
{:servlet-context "../" {:servlet-context "../"
:page page :page page}))))))
:asset-url asset-url}))))))
(defn compile-posts (defn compile-posts
"Compiles all the posts into html and spits them out into the public folder" "Compiles all the posts into html and spits them out into the public folder"
[default-params posts {:keys [blog-prefix post-root disqus-shortname asset-url]}] [default-params posts {:keys [blog-prefix post-root disqus-shortname]}]
(when-not (empty? posts) (when-not (empty? posts)
(println (blue "compiling posts")) (println (blue "compiling posts"))
(create-folder (str blog-prefix post-root)) (create-folder (str blog-prefix post-root))
@ -200,8 +199,7 @@
(merge default-params (merge default-params
{:servlet-context "../" {:servlet-context "../"
:post post :post post
:disqus-shortname disqus-shortname :disqus-shortname disqus-shortname}))))))
:asset-url asset-url}))))))
(defn compile-tags (defn compile-tags
"Compiles all the tag pages into html and spits them out into the public folder" "Compiles all the tag pages into html and spits them out into the public folder"
@ -220,15 +218,14 @@
(defn compile-index (defn compile-index
"Compiles the index page into html and spits it out into the public folder" "Compiles the index page into html and spits it out into the public folder"
[default-params {:keys [blog-prefix disqus? asset-url]}] [default-params {:keys [blog-prefix disqus?]}]
(println (blue "compiling index")) (println (blue "compiling index"))
(spit (str public blog-prefix "/index.html") (spit (str public blog-prefix "/index.html")
(render-file "templates/html/layouts/home.html" (render-file "templates/html/layouts/home.html"
(merge default-params (merge default-params
{:home true {:home true
:disqus? disqus? :disqus? disqus?
:post (get-in default-params [:latest-posts 0]) :post (get-in default-params [:latest-posts 0])}))))
:asset-url asset-url}))))
(defn compile-archives (defn compile-archives
"Compiles the archives page into html and spits it out into the public folder" "Compiles the archives page into html and spits it out into the public folder"
@ -258,16 +255,12 @@
(update-in [:sass-dest] (fnil str "css")) (update-in [:sass-dest] (fnil str "css"))
(update-in [:post-date-format] (fnil str "yyyy-MM-dd")) (update-in [:post-date-format] (fnil str "yyyy-MM-dd"))
(update-in [:keep-files] (fnil seq [])) (update-in [:keep-files] (fnil seq []))
(update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"]))) (update-in [:ignored-files] (fnil seq [#"^\.#.*" #".*\.swp$"])))]
site-url (:site-url config)
blog-prefix (:blog-prefix config)]
(merge (merge
config config
{:page-root (root-path :page-root config) {:page-root (root-path :page-root config)
:post-root (root-path :post-root config) :post-root (root-path :post-root config)
:tag-root (root-path :tag-root config) :tag-root (root-path :tag-root config)})))
:asset-root (str (if (.endsWith site-url "/") (apply str (butlast site-url)) site-url)
blog-prefix)})))
(defn compile-assets (defn compile-assets
"Generates all the html and copies over resources specified in the config" "Generates all the html and copies over resources specified in the config"
@ -303,8 +296,8 @@
(spit (str public blog-prefix "/" rss-name) (rss/make-channel config posts)) (spit (str public blog-prefix "/" rss-name) (rss/make-channel config posts))
(println (blue "compiling sass")) (println (blue "compiling sass"))
(sass/compile-sass->css! (sass/compile-sass->css!
(str "resources/templates/" sass-src) (str "resources/templates/" sass-src)
(str "resources/public" blog-prefix "/" sass-dest)))) (str "resources/public" blog-prefix "/" sass-dest))))
(defn compile-assets-timed [] (defn compile-assets-timed []
(time (time