Fork me on GitHub
#boot
<
2017-07-09
>
donyorm06:07:25

So in context of the below message, I need to compile my clojurescript and add it's location to resource-paths, so it can be accessed by the webserver I'm running and served to the client. What's the idomatic way to do this in boot?

richiardiandrea07:07:01

Usually you need to place the sources in : source-paths and boot-cljs takes care of adding the js to the the served files @donyorm

richiardiandrea07:07:54

You might need to add assets to resource-paths though

donyorm07:07:00

Yeah I found the asset-paths key after I posted that. I think it does what I want, but I still have yet to get it working.

richiardiandrea07:07:29

Yeah static files are not compiled and therefore you add them in there

richiardiandrea07:07:49

JS is added for you

donyorm07:07:04

@richiardiandrea So what path should I put into my html file. I currently have it looking in /js/main.js and it's not finding anything. /main.js also doesn't exist.

richiardiandrea09:07:43

donyorm: in which folder is this?

donyorm12:07:05

Sorry this is the html file loaded at localhost:3000/index.html. It's the luminus project I'm converting to boot, if that context helps.

richiardiandrea13:07:32

donyorm: so if you add resources/ then the content will be served at localhost:3000/js/index.html...

richiardiandrea13:07:52

Unless there is something else going on there

donyorm14:07:12

richiardiandrea: Sorry, add resources/ to what?

richiardiandrea15:07:46

see above, :resources-paths. What I meant is that what you have in :resources-paths will be served at the root of localhost:3000

Ruben W14:07:06

Hi, I’m trying to setup a boot task that - reloads clientside only when clojurescript changes, - serverside only restart when clojure code changes. The tasks themselves work fine, but right now only changes in clojurescript are picked up. Does anyone know how to accomplish this?

(deftask run-clj-dev []
  (comp
    (watch :verbose true :include #{#"\.(clj|cljc)$"})
    (system :sys #'dev-system :auto true :files ["api.clj"])
    (reload)
    (repl :server true :port 8009)))


(deftask run-cljs-dev []
  (comp
    (watch :verbose true :include #{#"\.(cljs|cljc)$"})
    (reload    :ids #{"js/main"})
    (cljs-repl :ids #{"js/main"} :nrepl-opts {:port 9009})
    (cljs      :ids #{"js/main"} :optimizations :none :source-map true)))

(deftask run-dev []
  (comp
    (run-clj-dev)
    (run-cljs-dev)))

martinklepsch15:07:11

@freakinruben you can’t have two watch tasks in the same pipeline

martinklepsch15:07:23

try boot watch run-clj-dev run-cljs-dev with the watch tasks inside these tasks removed

Ruben W15:07:21

martinklepsch: tnx! that works, but then my clojurescript also gets recompiled when clj files change

Ruben W15:07:18

any workaround for that?

martinklepsch15:07:06

hm. In theory .clj files might affect cljs compilation (bc. macros) so I’m not sure if there’s an easy way to avoid it

martinklepsch15:07:53

@freakinruben the compilation of your cljs should be super quick though given that nothing changed. What kind of compile times are you seeing?

Ruben W15:07:08

my machine is not really fast.. an empty main.cljs is about 1-2 seconds

Ruben W15:07:02

but it makes sense, thanks for clarifying!

chouser20:07:09

my boot installation appears to be broken. No matter what command I try to run, I get the same stack trace, which seems to be lacking critical details, like the path to the file with the error in it:

chouser20:07:35

Any ideas on how to proceed?

chouser21:07:51

deleting /.boot/cache and /.boot/tmp does not help

chouser21:07:57

reinstalling boot.sh does not help

chouser21:07:06

where is this boot.user file that apparently has a syntax error in it!?

chouser21:07:27

Ah, found it! I had a typo on line 150 of build.boot. It's unfortunate that neither that line number nor that file appeared anywhere in boot's error message.

chouser21:07:47

hm, actually line 150 is mentioned in the stack trace, for ClojureRuntimeShimImpl.java -- is that coincidence or a clue?

chouser21:07:30

Coincidence. Oh well.

alandipert22:07:22

@chouser boot.user:37 at the bottom there, does that correspond to the error? you can see boot’s idea of your build.boot with boot -b | cat -n

chouser22:07:52

ah, I see. Yes, that would have pointed at the right place.