Hi Zhao,
sorry to be so late, but I did not see your question until now. I was 
investigating a similar issue in writing a short series of clojurescript 
tutorials (https://github.com/magomimmo/modern-cljs). 

The problem of sharing in more pages the same js emitted by the 
clojurescript/closure compilers could be solved, in my case, just removing 
from the cljs code any js/window setting of properties (i.e. onload) and 
putting that (e.g (set! (.-onload js/windows) init)  call directly in a 
script tag in the corresponding  html pages as:

<script>modern_cljs.login.init();</script>

and 

<script>modern_cljs.shopping.init():</script>

If you take a look to the last published tutorial (i.e. tutorial 5) in 
https://github.com/magomimmo/modern-cljs 
you can find the context I'm talking about. 

HIH

Mimmo




On Tuesday, August 14, 2012 8:04:20 PM UTC+2, Zhao Shenyang wrote:
>
> Hi All,
>
> I'm building a website using noir as the backend and clojurescript as the 
> front end language. Instead of making a single page web application, I want 
> to split the application into different pages.
>
> Now the problem is, different pages need different js functions. I know 
> that by using cljsbuild  I can build different source paths to different js 
> files. So for each pages I can just make a cljs directory and let cljsbuild 
> compile it to a js file to be included by that page. However I wonder if 
> this solution is a little bit overkill for a simple website. Maybe I can 
> put all the cljs file in one directory (hence only produce one js file) and 
> use namespace to split functions for different pages.
>
> What solution do you use? Do you think your solution is better than the 
> other one? I want to hear your opinion. Thanks.
>
> regards,
> Zhao Shenyang
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to