Skip to content

Theme resolver #213

@acobster

Description

@acobster

IDEA

A themes is just a namespace that defines components as vars. All components for a given theme should be defined in a single namespace. (Whether they are required from an internal namespace is an implementation detail.) This makes it possible to go from an unqualified symbol like LoginPage and resolve it to a var representing a component.

A theme hierarchy is a sequence of themes (namespaces). Each theme in the sequence is checked, in order, to see whether it contains a var at a given symbol, such as LoginPage. The first theme found to have such a var is said to implement that component. For example, we can say that systems.bread.alpha.cms.theme.rise implements the LoginPage component because we can resolve the var #'rise/LoginPage.

This resolution is the job of the Theme Resolver.

(def resolver
  (theme-resolver {:themes ['my.theme 'systems.bread.alpha.cms.theme.crust 'systems.bread.alpha.cms.theme.rise]}))
(component/resolve-component resolver 'MyPage)
;; => #'my.theme/MyPage
(component/resolve-component resolver 'LoginPage)
;; => #'systems.bread.alpha.cms.themes.rise/LoginPage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions