Fork me on GitHub
Norman Kabir20:04:49

I'd like to include non-cljs files in my project (e.g. markdown (.md) and data (.dat)) that are copied as is from src. I found this but the files themselves are not copied into the target folder. Is it possible to configure non-cljs files to be watched and copied as raw text?


I think I know what Thomas will say since I've asked a similar question: No, and that is probably out of scope for shadow-cljs. But if you need to do this, you can accomplish it by just creating a script that manually starts the builds, and then also does the other file watching you require. You can do this by creating a script like: dev.clj:

(ns dev
   [shadow.cljs.devtools.api :as shadow]))

(defn setup
  {:shadow/requires-server true}
  ;; Start your other watchers here, using libraries like juxt dirwatch
  (shadow/watch :front))
Then just run
yarn shadow-cljs run dev/setup
Instead of shadow-cljs watch.

Norman Kabir21:04:01

I thought I was missing something because copying html is supported (on a file-by-file basis). Thank you for your suggestion! I cobbled together a package.json solution using •


Ok 👍. I did it the script way because I didn't want to inflict more process starting on my co-workers.

Norman Kabir16:04:38

Your solution is definitely more elegant.

Richard Bowen23:04:29

Hey is there a specific way to pull in this function as shown in the example: I've tried ["copy-to-clipboard" :refer [copy]] but I get the following error:

Uncaught TypeError: module$node_modules$copy_to_clipboard$index.copy is not a function
    at eval (effects.cljs:66:5)
    at re_frame$fx$do_fx_after (fx.cljc:59:23)
    at Object.re_frame$interceptor$invoke_interceptor_fn [as invoke_interceptor_fn] (interceptor.cljc:70:6)
    at Object.re_frame$interceptor$invoke_interceptors [as invoke_interceptors] (interceptor.cljc:108:24)
    at Object.re_frame$interceptor$execute [as execute] (interceptor.cljc:201:8)
    at Object.re_frame$events$handle [as handle] (events.cljc:65:14)
    at Object.eval [as re_frame$router$IEventQueue$_process_1st_event_in_queue$arity$1] (router.cljc:179:10)
    at Object.eval [as re_frame$router$IEventQueue$_run_queue$arity$1] (router.cljc:198:44)
    at eval (router.cljc:146:64)
    at Object.eval [as re_frame$router$IEventQueue$_fsm_trigger$arity$3]
I've also tried ["copy-to-clipboard" :as copy] which seems more like what is shown in the example. But it doesn't seem to work and returns no errors.

Richard Bowen23:04:11

Ok, :as does the trick.