lein-ring
lein-ring copied to clipboard
:reload-paths equivalent for :auto-refresh?
I've been using lein ring serve with :auto-reload? and auto-refresh? both true which have been working great.
I've now added figwheel to start to add javascript, this tool pushing changes into the browser directly. This of course doesn't require a reload or refresh on the part of the server, i.e. lein ring needn't (shouldn't!) be involved at all in this.
I note that :reload-paths applies to :auto-reload (i.e. the server state), and it seems not to :auto-refresh (browser refresh).
Is there a way to limit which paths trigger :auto-refresh? I'd like to exclude the location where I have cljs files from triggering that.
I thought I might be able to restrict :auto-refresh by moving the file I don't want to trigger it (the .cljs file) to a location not included in leningen :source-paths, but that hasn't worked, it's still triggering a refresh.
I've made some progress on this - by adding ring-refresh explicitly, rather than relying on it being added by :auto-refresh, and specifying only "src". With this setup, figwheel injects smoothly into the page served by jetty without a refresh. However, when I edit a file in src (a server rendered hiccup page) the page itself reloads fine as normal, but the moment it loads and the react component mounts, a second reload is immediately triggered. Any idea why?
You can customize these by adding :reload-paths and :refresh-paths to the :ring options in your project.clj file.
Thanks so much - so simple. :) Would you like a pull request to document this in web server options?
Yes please.