kioo
kioo copied to clipboard
Integrating with ClojureScript's auto
It's not exactly kioo's problem, but if you update a kioo template, the ClojureScript compiler doesn't recompile. Not sure if anything can be done about this (short of a modification to the ClojureScript compiler, which would require a lot of thought).
I've been using the browser repl for this and just recompiling when I change the code, and it's been working really well.
I have a command line file watcher that watches my templates and runs touch src/cljs/foobar/components.cljs
on every change, which triggers the recompile of the correct cljs file.
If you install the guard program (https://github.com/guard/guard) and guard-shell then a guard file with a section like this:
guard :shell do
watch(/resources\/templates\/.*/) {
`touch src/cljs/foobar/file-where-templates-are-defined.cljs`
}
end
will do the trick, as would any other method of triggering shell commands on file changes.
While never having worked in the ruby ecosystem I'm a big fan of guard especially because of guard-livereload, I have a few other lines that don't just recompile my js but reload my browser for me as well (or only reload the js/css/whatever instead of doing a full page reload) which I now can't live without.
guard works great. One note, there are backticks around the touch command, not apostrophes. I missed that. Also if you have notifications in linux you can send one with the n command.
guard :shell do
watch /resources\/public\/html\/.*/ do |m|
n m[0], 'Changed', :success
`touch src/cljs/foo/bar.cljs`
end
end