Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow access to settings from ClojureScript #9

Open
jblomo opened this issue Sep 5, 2011 · 1 comment
Open

Allow access to settings from ClojureScript #9

jblomo opened this issue Sep 5, 2011 · 1 comment

Comments

@jblomo
Copy link
Owner

jblomo commented Sep 5, 2011

There are probably many instances in which you'd like to share settings between server side and client side code. Right now settings.clj and settings/custom.clj are only used by server side clojure. All settings should probably not be shared: you don't want to ship your database settings to the client side.

One way to do this might be to use the Closure compiler's @define / --define semantics.

@jblomo
Copy link
Owner Author

jblomo commented Sep 11, 2011

I've written an initial version of this, but am open to changes.

Settings are organized into namespaces. Each namespace has an 'options Var that contain stuff like :dev-mode. Each settings namespace may load options differently, but typically they set up some defaults then merge in the options from "settings/[name].clj" in the classpath. The classpath includes test-resources and resources in development, but only resources in production. See (test-)resources/settings/global.clj as an example.

Sharing settings with CLJS is done at compile time. A clojure macro that is given a name and a namespace will def that name as the options map for the namespace. See cljs/src/initializer/settings-page.cljs for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant