Fork me on GitHub
#perun
<
2016-10-31
>
bhagany02:10:04

Alright, next stumbling block: css reloading. My setup that’s still very similar to the getting started wiki… here’s the task I’m running:

(deftask dev
  []
  (comp (serve :resource-root "public/")
        (watch :verbose true)
        (markdown)
        (render :renderer 'nicerthantriton.core/dev-page)
        (reload)
        (cljs)))
I have a css file at public/css/ntt.css in my resource folder. Since I’m serving out of public/, my markup refers to css/ntt.css, but when I modify the file, boot-reload tries to load public/css/ntt.css and 404’s. I’ve figured out how to prepend a value to the asset path, but can’t seem to figure out how to tell boot-reload to leave the “public/” off the url it tries to reload. Any tips?

martinklepsch08:10:41

@bhagany: pass :asset-path "public/" to the reload task

martinklepsch08:10:37

Did cljs reloading work properly without that? I think it should run into the same issue

bhagany12:10:30

@martinklepsch I had tried that, but couldn’t tell what effect it had. I just tried it again, and still no effect.

bhagany12:10:53

I don’t have any cljs of my own in this project yet, so css is the first non-html reloading I’ve tried.

bhagany12:10:01

oddly, even setting :asset-path “foo/” still results in a 404 to something like on reload

martinklepsch12:10:23

Odd indeed, sure you're passing it to the reload task? Maybe paste relevant parts of your build.boot

bhagany12:10:45

here’s my entire build.boot:

bhagany12:10:47

(set-env!
 :source-paths #{"src" "content"}
 :resource-paths #{"resources"}
 :dependencies '[[pandeiro/boot-http "0.7.0"]
                 [adzerk/boot-cljs "1.7.228-2" :scope "test"]
                 [adzerk/boot-reload "0.4.12" :scope "test"]
                 [hiccup "1.0.5"]
                 [perun "0.3.0" :scope "test"]])

(require '[adzerk.boot-cljs :refer [cljs]]
         '[pandeiro.boot-http :refer [serve]]
         '[adzerk.boot-reload :refer [reload]]
         '[io.perun :refer :all])

(deftask dev
  []
  (comp (serve :resource-root "public/")
        (watch :verbose true)
        (markdown)
        (render :renderer 'nicerthantriton.core/dev-page)
        (reload :asset-path "foo/")
        (cljs)))

martinklepsch12:10:02

Ok so actually not odd, what asset path does is it strips something from the beginning of paths so foo/ does not have any effect

martinklepsch12:10:21

Are you getting this error when a reload is initiated or on initial load?

bhagany12:10:43

only on reload

bhagany12:10:51

I’ve manually set the href in my markup for the initial load

martinklepsch12:10:04

You may also need to pass something like asset-path to the compiler via cljs.edn

martinklepsch12:10:40

Can't look up a snippet right now but I suggest you ask in #boot more people there

martinklepsch12:10:52

I'll look something up once I'm on my computer

bhagany12:10:56

I did that, in order to get the load path right for reload

bhagany12:10:59

{:compiler-options {:asset-path “js/main.out”}}

bhagany12:10:28

I will ask in #boot in a bit - have to take my kids to school

bhagany12:10:35

thanks for looking at it!

martinklepsch12:10:46

Np, talk later

martinklepsch14:10:00

@bhagany so after re-reading I'd suggest :asset-path "/public" (try with leading slash maybe that's our mistake)

martinklepsch14:10:07

It might to a ^ anchored replace so I'm optimistic that this will be the solution 🙂

martinklepsch14:10:16

Maybe we should warn if the string does not start with /

bhagany14:10:30

yup, that was it! Thank you.