This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-23
Channels
- # aleph (9)
- # beginners (30)
- # boot (42)
- # carry (1)
- # cider (148)
- # clara (2)
- # cljsrn (13)
- # clojars (2)
- # clojure (90)
- # clojure-dev (1)
- # clojure-dusseldorf (2)
- # clojure-italy (7)
- # clojure-madison (1)
- # clojure-quebec (1)
- # clojure-russia (19)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (90)
- # clojurebridge (1)
- # clojurescript (70)
- # clr (7)
- # core-async (24)
- # cursive (26)
- # data-science (2)
- # datascript (3)
- # datomic (46)
- # devops (2)
- # emacs (6)
- # events (1)
- # figwheel (2)
- # hoplon (200)
- # klipse (2)
- # ldnclj (1)
- # lein-figwheel (4)
- # leiningen (3)
- # off-topic (44)
- # om (70)
- # other-languages (6)
- # pedestal (5)
- # protorepl (1)
- # re-frame (17)
- # reagent (14)
- # schema (2)
- # spacemacs (1)
- # specter (3)
- # test-check (38)
- # unrepl (38)
- # untangled (19)
- # yada (16)
@mudphone I don't think I know of the talk you saw, but in my experience, this kind of thing is done in the context of a watch
task, and the caching is done in memory.
So, the cache doesn't live beyond a single boot invocation - it's only useful for subsequent runs of a task in the same process
By which I mean, are you using the word "reload" kind of generically, or are you referring to the specific reload
task?
Okay, yeah - so watch doesn't really know anything about caches, but it does make it feasible for other tasks to have them, because everything stays in the same process. I don't know for sure, but I would bet that boot-reload is tracking things in some sort of internal cache itself, to keep track of what files are newly changed on each watch
loop
okay, yeah, here: https://github.com/adzerk-oss/boot-reload/blob/master/src/adzerk/boot_reload.clj#L138
In case you could use some commentary on the link - it's comparing the fileset from the previous time the task was run (aka prev
) to the current fileset, and only acting on edn files that have changed
danielsz.autoprefixer
…
okay, it should work the same general way. whatever task is running autoprefixer would have to do fileset diffing similarly to the link from boot-reload, and only run autoprefixer on css files that have changed since the last run
I'm looking here: https://github.com/danielsz/boot-autoprefixer/blob/master/src/danielsz/autoprefixer.clj
and I don't see any caching - it just runs on every css file every time
oh, okay
https://github.com/boot-clj/boot/blob/f66aaf387740dc5968bde3f74a8761da154cab13/boot/core/src/boot/task/built_in.clj#L696-L699 https://github.com/boot-clj/boot/blob/ac835cea8c18e926bb843e01579b86e3f30458d2/doc/boot.core.md#add-cached-resource The docs aren't quite in place yet though. But caching of the kind you mentioned is there.
Simple tasks can use fileset-diff
to check the changed files and recompile those. Simple example can be found at deprecated Boot-cljx: https://github.com/Deraen/boot-cljx/blob/master/src/deraen/boot_cljx.clj#L29-L32, but for example less4clj/sass4clj use the same solution.
@U09LZR36F thanks for the help. I’m a little confused by the term “per-task,” could you please explain what that is?
@U061V0GG2 okay, I think that explains why my sass is only loaded one time (unless changed)
@mudphone uh, I was trying to reuse a term I thought I saw used earlier. Basically it persists outside of the fileset-diff ^^
Hmm I think I’m still confused about what happens in the sift
task… I think I need to do more experiments.
https://github.com/boot-clj/boot/blob/f66aaf387740dc5968bde3f74a8761da154cab13/boot/core/src/boot/task/built_in.clj#L696-L699 https://github.com/boot-clj/boot/blob/ac835cea8c18e926bb843e01579b86e3f30458d2/doc/boot.core.md#add-cached-resource The docs aren't quite in place yet though. But caching of the kind you mentioned is there.
ok, so I am writing an external (Closure-compatible) js lib and using {:compiler-options {:libs ["libs/foo.js"]}}
for my cljs
task. It works, but I suppose I need to add it to :source-paths
for watch
to recompile. Is this the recommended way to do this?
also, I’m using :source-map true
and Chrome seems to find my source maps, but the files are empty in dev tools