Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 1.15 KB

README.md

File metadata and controls

23 lines (13 loc) · 1.15 KB

code-splitting-example

This is an example of using clojurescript modules to do code-splitting. It also works with figwheel 0.5.15-SNAPSHOT. There are some workarounds to get expected functionality commonly used in clojure(script) projects, like a dev ns that calls functions like enable-console-print! once, and :on-jsload hooks.

Structure

env/dev/.../common.cljs

Namespace annotated with ^:figwheel-no-load. Here are functions called exactly once for every module.

env/dev/.../a.cljs & b.cljs

These are module specific dev namespaces. they require the a and b src/ entries, and perform module specific functions. these are reloaded whenever their respective modules change, and any non-idempotent calls should be wrapped in a defonce to not be evaluated on subsequent reloads.

src/.../common.cljs

This namespace is required by both modules, and shows how to share code across modules.

src/.../module-a.cljs & module-b.cljs

These are the actual modules that do page specific things.

src/.../handler.clj

NOTE: handlers will each load different script sources, but all must load cljs_base.js, as this will contain any shared code.