diff --git a/src/nextjournal/clerk/builder.clj b/src/nextjournal/clerk/builder.clj index bda4ae62f..048483083 100644 --- a/src/nextjournal/clerk/builder.clj +++ b/src/nextjournal/clerk/builder.clj @@ -318,15 +318,18 @@ (spit (str tw-folder "/viewer.js") (slurp (let [js-url (get resource->url "/js/viewer.js")] (cond->> js-url (view/relative? js-url) (str out-path fs/file-separator))))) - (doseq [[src dest] (map (juxt #(io/resource (str "nextjournal/clerk/" %)) - #(doto (fs/path tw-folder %) create-parent-dirs)) files-with-tw-classes)] - (fs/copy src dest {:replace-existing true}))) + (do + (println "Tailwind: using cljs source files as input…") + (doseq [[src dest] (map (juxt #(io/resource (str "nextjournal/clerk/" %)) + #(doto (fs/path tw-folder %) create-parent-dirs)) files-with-tw-classes)] + (fs/copy src dest {:replace-existing true})))) (doseq [{:keys [file viewer]} docs] (spit (let [path (fs/path tw-folder (str/replace (str file) #"\.(cljc?|md)$" ".edn"))] (create-parent-dirs path) (str path)) (pr-str viewer))) + (let [tw-command (if (zero? (:exit (try (sh "which tailwindcss") (catch Throwable _)))) "tailwindcss" "npx tailwindcss") {:as ret :keys [out err exit]} (try (sh tw-command