reframejs/reframe

Significance of $ in Reframe config properties

aleclarson opened this issue · 2 comments

What's the reasoning behind starting certain properties with $ (like $name or $plugins) in the Reframe config?

These are special properties for @brillout/reconfig

@brillout/reconfig is the library Reframe uses to do configuration and dependency injection.

$name is the name of the plugin (useful for debugging).

$plugins is the list of "sub-configs" that @brillout/reconfig recursively applies. It's basically dependency injection: E.g. by changing @reframe/react to @reframe/vue you change config.renderToHtml and config.renderToDom which are used to render your page's views.

I'm leaving this ticket open as a TODO to add documentation explaining @brillout/reconfig and these special $ properties.

@brillout/reconfig is now a trivial one line of code :-).

module.exports = global['@brillout/reconfig'] = global['@brillout/reconfig'] || {};

Turns out that a single global JS object is a great idea as a backbone for DI, a plugin system, and config.