Created
December 16, 2022 16:27
-
-
Save laheadle/0962ae6a265f53d1e43b03c9731d61c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:deps {cider/cider-nrepl {:mvn/version "0.28.3"} | |
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns org.stinkless.earth-book.tasks | |
(:require | |
[babashka.fs :as fs] | |
[babashka.tasks :refer [clojure shell]] | |
[clojure.java.io :as io] | |
[com.biffweb.tasks :as btasks])) | |
(defn run-args [] | |
["-J-XX:-OmitStackTraceInFastThrow" | |
"-M" "-m" (:biff.tasks/main-ns @btasks/config) | |
"--port" "7888" | |
"--middleware" "[cider.nrepl/cider-middleware refactor-nrepl.middleware/wrap-refactor]"]) | |
(defn tailwind-path [] | |
"bin/tailwindcss") | |
(defn dev | |
"Starts the app locally. | |
After running, wait for the `System started` message. Connect your editor to | |
nrepl port 7888. Whenever you save a file, Biff will: | |
- Evaluate any changed Clojure files | |
- Regenerate static HTML and CSS files | |
- Run tests" | |
[& args] | |
(io/make-parents "target/resources/_") | |
(when (fs/exists? "package.json") | |
(shell "npm" "install")) | |
(when-not (fs/exists? (tailwind-path)) | |
(btasks/install-tailwind)) | |
(future (btasks/css "--watch")) | |
(spit ".nrepl-port" "7888") | |
(apply clojure {:extra-env {"BIFF_ENV" "dev"}} | |
(concat args (run-args)))) | |
;; (defn hello | |
;; "An example of a custom task. See ./tasks/" | |
;; [] | |
;; (println "Hello there.")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment