compile works again

master
jem 5 years ago
parent fa3d903c01
commit 843e0eaaec

@ -490,21 +490,20 @@
"Generates all the html and copies over resources specified in the config" "Generates all the html and copies over resources specified in the config"
[] []
(println (green "compiling assets...")) (println (green "compiling assets..."))
(let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-dest keep-files ignored-files previews? (let [{:keys [^String site-url blog-prefix rss-name recent-posts sass-dest keep-files ignored-files previews?
author-root-uri theme debug? page-model page-root-uri ] author-root-uri theme debug? page-model page-root-uri]
:as config} (read-config) :as config} (read-config)
posts (map klipsify (add-prev-next (read-posts config))) posts (map klipsify (add-prev-next (read-posts config)))
posts-by-tag (group-by-tags posts) posts-by-tag (group-by-tags posts)
posts (tag-posts posts config) posts (tag-posts posts config)
latest-posts (->> posts (take recent-posts) vec) latest-posts (->> posts (take recent-posts) vec)
klipsified-pages (map klipsify (read-pages config)) klipsified-pages (map klipsify (read-pages config))
modelled-pages (cond modelled-pages (cond
(= page-model :flat) klipsified-pages (= page-model :flat) klipsified-pages
(= page-model :hierarchic) (hierarchic/build-hierarchic-map page-root-uri klipsified-pages) (= page-model :hierarchic) (hierarchic/build-hierarchic-map page-root-uri klipsified-pages))
)
home-page (->> modelled-pages home-page (->> modelled-pages
(filter #(boolean (:home? %))) (filter #(boolean (:home? %)))
(first)) (first))
other-pages (->> modelled-pages other-pages (->> modelled-pages
(remove #{home-page}) (remove #{home-page})
(add-prev-next)) (add-prev-next))
@ -516,22 +515,25 @@
:latest-posts latest-posts :latest-posts latest-posts
:pages other-pages :pages other-pages
:home-page (if home-page :home-page (if home-page
home-page home-page
(assoc (first latest-posts) :layout "home.html")) (assoc (first latest-posts) :layout "home.html"))
:archives-uri (page-uri "archives.html" config) :archives-uri (page-uri "archives.html" config)
:index-uri (page-uri "index.html" config) :index-uri (page-uri "index.html" config)
:tags-uri (page-uri "tags.html" config) :tags-uri (page-uri "tags.html" config)
:rss-uri (cryogen-io/path "/" blog-prefix rss-name) :rss-uri (cryogen-io/path "/" blog-prefix rss-name)
:site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})] :site-url (if (.endsWith site-url "/") (.substring site-url 0 (dec (count site-url))) site-url)})
file-resource-path (str "file:resources/templates/themes/" theme)
classpath-resource-path (str "templates/themes/" theme)]
(when debug? (when debug?
(println (blue "debug: page-model:")) (println (blue "debug: page-model:"))
(println "\t-->" (cyan page-model)) (println "\t-->" (cyan page-model))
(println (blue "debug: home-page:")) (println (blue "debug: home-page:"))
(println "\t-->" (cyan (-> params :home-page))) (println "\t-->" (cyan (-> params :home-page))))
) ;; TODO: replace by file-resource-path or classpath-resource-path
(set-custom-resource-path! (str "file:resources/templates/themes/" theme)) (set-custom-resource-path! (str "file:resources/templates/themes/" theme))
(cryogen-io/wipe-public-folder keep-files) (cryogen-io/wipe-public-folder keep-files)
(println (blue "copying theme resources")) (println (blue "copying theme resources"))
;; TODO: adjust for reading from jar
(cryogen-io/copy-resources-from-theme config) (cryogen-io/copy-resources-from-theme config)
(println (blue "copying resources")) (println (blue "copying resources"))
(cryogen-io/copy-resources config) (cryogen-io/copy-resources config)
@ -557,9 +559,9 @@
(rss/make-filtered-channels config posts-by-tag) (rss/make-filtered-channels config posts-by-tag)
(println (blue "compiling sass")) (println (blue "compiling sass"))
(sass/compile-sass->css! (sass/compile-sass->css!
(merge (select-keys config [:sass-path :compass-path :sass-src :ignored-files]) (merge (select-keys config [:sass-path :compass-path :sass-src :ignored-files])
{:sass-dest (cryogen-io/path ".." "public" blog-prefix sass-dest) {:sass-dest (cryogen-io/path ".." "public" blog-prefix sass-dest)
:base-dir "resources/templates/"})))) :base-dir "resources/templates/"}))))
(defn compile-assets-timed [] (defn compile-assets-timed []
(time (time

Loading…
Cancel
Save