For instance:
(enable-console-print!)
(extend-type js/RegExp ;; allow regexp to be called https://gist.github.com/alandipert/2346460
IFn
(-invoke ([this s] (re-matches this s))))
What is the best way to make sure init.cljs is compiled before the rest of the project?
init.cljs:
(ns init)
(enable-console-print!)
..
something.cljs:
(ns something
(:require [init]))
As for compilation I cannot speak for other tools (like lein-cljsbuild) but shadow-build [1] compiles in the mentioned order. As long as the (ns ..) declaration is correct I expect other tools to do the right thing too.
HTH,
/thomas
[1] https://github.com/thheller/shadow-build
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to a topic in the Google Groups "ClojureScript" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/mDI0HKfSrg4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.
It sounds to me like you may be thinking about this backwards. You don’t necessarily want to (enable-console-print!) any time that code is run, just when you’re running your entire app. Rather than require that code from each of your files, I’d suggest putting it at the top of (or requiring it from) the entrypoint into your application, and possibly a dev-specific entrypoint. For instance, in the Chestnut template, there’s a namespace loaded only in dev which kicks off the rest of the application. There’s a similar one from production which doesn’t load development concerns.
Doing it this way keeps your “real” code blissfully unaware of the way it’s being used. (And it’s a lot easier than requiring a utility namespace in every file for the sake of side-effects.)
Peter
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.