Separate ClojureScript assemblies for a multi-page web application

I have a web application that uses Clojure on the backend and ClojureScript on the frontend, and it consists of several pages, each of which requires a corresponding js build file.

Now I know that cljsbuild can create separate assemblies (if indicated in the section: assembly the configuration file), provided that each assembly has its own folder.

Problem : now I need to duplicate some kind of common code in each folder for proper assembly. Also, it is really annoying that I have to create a whole new folder for even the trivial cljs file that will be used, not to mention editing every time: builds section of my project.clj.

So, this is 2016, and all the ClojureScript tutorials I've seen so far are for single-page applications. Are there any resources or best practices for what I'm looking for, have I missed something?

How to use ClojureScript in a standard multi-page Clojure-stack web application?

Thank.

+4
source share
3 answers

:modulesYou can use the compiler option to split your clojurescript assembly into optimized modules, which may be required on demand.

+1
source

Do you really need some cljs compilations?

, export , , dom, ?

0

It can be as simple as using requirefrom one namespace to another.

For example, let's say you have the following structure:

project β”œβ”€β”€ src β”‚   └── cljs β”‚   β”œβ”€β”€ page1 β”‚   β”œβ”€β”€ page2 β”‚   β”‚  

You can requirestuff from the namespace page1.subnamespacefrom the inside page2.

0
source

All Articles