Fork me on GitHub
#shadow-cljs
<
2018-09-07
>
Hukka10:09:13

For some reason I'm not getting newest cljs source in Chrome's devtools. I know the source has updated, since the console.log fires, but even when I click the logged line, I end up in a line that doesn't have any logging. Is it a problem in the Chrome, or might there be something messing my source maps?

thheller11:09:18

@tomi.hukkalainen_slac are you using the built-in http server or some other web server? the built-in disables all caching to prevent stuff like this, others may not

pvillegas1214:09:09

I’m using the :module-hash-names true option for my build, looks like manifest.edn has the mapping to the output name, but how do I make index.html point to that specific js file?

thheller14:09:57

what are you using to generate the index.html?

pvillegas1214:09:16

🙂 good question, what should I use?

thheller14:09:07

well that kinda depends on what you are doing? 😛

thheller14:09:20

I have a clojure webserver that generates my HTML via hiccup

pvillegas1214:09:25

I want to serve a fulcro app from s3

Hukka14:09:44

@thheller Jetty, with ring

thheller14:09:27

or rather would be an answer. there are many things you can do. how are you doing deployment overall?

pvillegas1214:09:36

I’m currently investigating how to go about this, but currently thinking to do shadowcljs release main with the md5 hashed javascript, push it to S3 and use cloudfront to serve the assets. However, I am trying to get this working with both the index.html and css parts of the build

thheller14:09:16

then clj-run sounds good maybe?

👀 4
thheller14:09:34

(defn release [server]
  (shadow/release :my-build)
  (-> (io/file "output-dir" "js" "manifest.edn")
      (slurp)
      (edn/read-string)
      (generate-index-html))
  (sh "build-my-css" ...)
  (sh "rsync" "-arzt" "path/to/output-dir" server))

pvillegas1214:09:35

@thheller you mean writing the deploy script in clj right?

thheller14:09:32

could be done via make. Just read the manifest.edn and generate the index.html for it via whatever means you prefer?

pvillegas1214:09:54

👍 bit new to this release manually part, thanks!

pvillegas1214:09:22

@thheller any pointers for css bundling?

justinlee18:09:33

i was helping someone in another channel with macros and i realized this works:

[2:1]~cljs.user=> (defmacro foo [] `(1 2 3))
#'cljs.user/foo
[2:1]~cljs.user=> (foo)
(1 2 3)

justinlee18:09:46

how can defmacro work in a cljs repl?

lilactown18:09:41

works in figwheel.main too

thheller19:09:43

it doesn't work. you are just calling a function.

justinlee19:09:22

why does it even let me do it? the only reason i’m asking is because i sort of thought it would throw an error

thheller20:09:22

self-host reasons I guess

richiardiandrea20:09:22

the test for that is if (macroexpand '(foo)) actually works

justinlee20:09:53

it doesn’t. the fact that it doesn’t proves that i don’t understand the cljs macro system even a little bit

richiardiandrea20:09:13

it's simple, they never work 🙂

justinlee20:09:23

even simpler: i never use them 🙂