Skip to content

clojure-examples/code-splitting-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

example of code splitting with figwheel

Resources

License

EPL-1.0, GPL-3.0 licenses found

Licenses found

EPL-1.0
LICENSE
GPL-3.0
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published