I'm working on a web site which, for various reasons, achieves its purpose best 
with multiple pages rather than as a single-page app. All the pages will need 
to share some code in common.

In a plain vanilla JS environment, I could do something like this on page1.html:

<script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="page1.js"></script>

and something similar on page2.html (with <script> tags for common.js and 
page2.js)

I want to achieve a similar effect using ClojureScript. I'm pretty sure I could 
make a ClojureScript project for the common code and do a "lein install", thus 
enabling me to put [com.langintro/common-code "0.0.1"] in my dependencies.

If I make separate projects for page1 and page2, they will each have their own 
copy of the common code. 

If I have a single project "all-pages" with files page1.cljs and page2.cljs and 
corresponding namespaces (ns all-pages.page1) and (ns all-pages.page2), then 
I'll have only one copy of the common code. However, each <script> element at 
the end of page1.html and page2.html has to act like the <script> at the end of 
a typical page that references the JavaScript generated by core.cljs (the 
"main" function), and I'm not sure how to achieve that effect.

This: 
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html 
looks as if it has the answer, but I'm just not making the correct connection.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to