Fork me on GitHub
#hoplon
<
2016-03-31
>
leontalbot17:03:28

Hello guys! How Do I set automatic reload to only certain pages in dev task?

leontalbot17:03:48

At first, I was enjoying that every page reloads after I save, but now that I have more pages, it gets slower. I really am working on one at a time (plus two components pages like views.cljs.hl and forms.cljs.hl) so I don't need to reload everything after I save... Thanks in advance!

leontalbot17:03:59

And by the way, thank you for your help on prior problems. Your support gives me confidence to run hoplon in production!

dm318:03:34

@leontalbot: I have the following function running :on-jsload in boot-reload:

(defn refresh []
  (. js/hoplon.app_pages._index_DOT_html render))

dm318:03:51

where render is a function in my index.cljs.hl

leontalbot19:03:29

Thanks for the answer. Where do you put (defn refresh...)? If I put it in boot.build file, I get

clojure.lang.ExceptionInfo: No such namespace: js

alandipert19:03:45

@leontalbot: i think he meant to put that code in a .cljs file and then pass the ns/function name to the :on-jsload param of the reload task

leontalbot20:03:50

Thanks @alandipert . I now find no error. But every pages seems still to be reloading when I do a change.

Compiling Hoplon pages...
• vpc_hoplon/index.cljs.hl
Adding :require adzerk.boot-reload to index.html.cljs.edn...
Compiling ClojureScript...
• coworking.html.js
• evenements-vieux-limoilou.html.js
• index.html.js
• parcs-beauport.html.js
• quartierouvert.html.js
Elapsed time: 12,136 sec

leontalbot20:03:49

I meant, all the clojurescript is recompiling, can this be avoided?

leontalbot20:03:05

to speed up reload time?

dm320:03:51

are they interdependent?

dm320:03:14

you could try splitting the build into separate parts depending on what you're currently working on

leontalbot20:03:57

@dm3 no, these are all independant pages

leontalbot20:03:33

in your experience does saving cause to reload all the cljs from the pages?

dm320:03:46

I just have one page

dm320:03:49

per project

dm320:03:54

so havent' tried

leontalbot20:03:01

yeah I heard we should avoid multi pages and have client side routing

leontalbot20:03:14

that's what you do?

alandipert20:03:26

@leontalbot: another option is a sift task in there before hoplon

alandipert20:03:37

you could use it to filter out the pages you're not working on before compilation

leontalbot20:03:27

cool! would you mind sharing an example (code)?

alandipert20:03:03

@leontalbot: can you paste your dev task? i can try to modify it

alandipert20:03:28

using my Slack IDE ™️

alandipert21:03:33

@leontalbot: sorry got busy w/ work stuff, i'll take a stab at this later

alandipert21:03:04

it may be to complex to just use the sift task, but the idea i wanted to pursue is a deftask that filters out all the .cljs.hl from the fileset except those specified

alandipert21:03:43

using boot.core/by-ext and boot.core/rm

leontalbot23:03:12

Thanks @alandipert for looking at it when you have time 😄 I am not familiar with boot tasks... Should we just hack hoplon task to be able to do

(hoplon :hl-files-subset #{"index.cljs.hl"})
? or there is a way to compose it with a custom task?