Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClojureScript's separate builds for multipage web app

I have a web app that uses Clojure on backend and ClojureScript on frontend, and it consists of several pages, each requiring appropriate builded js file.

Now I know that cljsbuild can build separate builds (if specified in :builds section of config file), provided that each build has it's own folder.

Problem is: now I need to duplicate some shared code in each folder in order to build properly. Besides, it's really annoying that I have to create whole new folder for even trivial cljs file to be used, not to mention editing every time the :builds section of my project.clj.

So, it's 2016, and all the tutorials on ClojureScript I've seen so far, are for single-page applications. Are there any resources or best practices for what I'm looking for, am I missing something out?

How do I use ClojureScript in standard multi-page Clojure-stack web app?

Thanks.

like image 567
Twice_Twice Avatar asked Oct 30 '22 02:10

Twice_Twice


1 Answers

The :modules compiler option can be used to split your clojurescript build into optimized modules that can be required on demand.

like image 90
Terje Norderhaug Avatar answered Nov 08 '22 08:11

Terje Norderhaug