reagent-project / reagent-template

A Leiningen template for projects using Reagent.
MIT License
394 stars 55 forks source link

println in development must be removed in production #49

Closed arsenerei closed 9 years ago

arsenerei commented 9 years ago

I've left comments in for debugging and production will fail since the enable-console-print! is not called in production. Is it proper just to remove them? I find them useful to keep sometimes between versions and I'd rather silently ignore them than have to outright remove them.

yogthos commented 9 years ago

Ideally, you wouldn't put comments in for production. However, you could set the *print-fn* to something like (fn [& args]) that will simply ignore print statements in prod. You could do that by editing env/prod/cljs/<app-name>/prod.cljs and adding the following line there:

(set! *print-fn* (fn [& -]))

You can take a look for some more details on what's going on with println in cljs here.

yogthos commented 9 years ago

I'll update the template to do this by default as I don't really see any harm in that.

arsenerei commented 9 years ago

Thanks, I appreciate it. I added it in my project and it worked out.