#!/usr/bin/env bb ;; Usage: bb build.clj (require '[babashka.tasks :refer [shell]]) ;; configuration (def theme-path "themes/venin") ;; banner (defn banner [] (println " ▐ ▄▄ ▄▖ ▄▖ ▄▟ ▄▖ ▄▖ ▗▄▖ ▖▄ ▄▖ ▐▘▜ ▐▘▐ ▐▘▐ ▐▘▜ ▐▘▐ ▝ ▐ ▐▘▜ ▛ ▘▐▘▜ ▐ ▐ ▐▀▀ ▐▀▀ ▐ ▐ ▐▀▀ ▗▀▜ ▐ ▐ ▌ ▐ ▐ ▝▙▜ ▝▙▞ ▝▙▞ ▝▙█ ▝▙▞ ▝▄▜ ▐ ▐▙▛ ▌ ▝▙▛ ▖▐ ▐ ▝▘ ▝ ")) ;; build steps (defn pull-new-changes [] ;; pull from content repository (println "☠︎ Pulling from content repository...") (shell "git" "pull" "origin" "master") ;; pull from theme repository (println "☠︎ Pulling from theme repository...") (shell {:dir theme-path} "git" "pull" "origin" "master")) (defn build-theme [step] (println (str "☠︎ " step "-building theme...")) (shell {:dir theme-path} "bb" "build.clj" (str step "-build"))) (defn build-site [no-cache?] (println "☠︎ Generating static site...") (shell "hugo" "--gc" "--minify" (cond no-cache? "--ignoreCache"))) ;; main process (defn before-build-site [] (pull-new-changes) (build-theme "pre")) (defn after-build-site [] (build-theme "post")) (let [[no-cache?] *command-line-args*] (banner) (before-build-site) (build-site (parse-boolean (or no-cache? "false"))) (after-build-site))