-
Notifications
You must be signed in to change notification settings - Fork 143
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
Update @embroider/macros examples in the readme #554
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
### getOwnConfig, getConfig, and getGlobalConfig | ||
|
||
A common pattern is to have a set of configuration properties that you define (or a consumer defines for you) which you base certain build time conditions around. This is achieved via the `getOwnConfig`, `getConfig`, and `getGlobalConfig` macros (depending on which config you want to read). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explain those in a bit more detail? Like getGlobalConfig
was new to me, and not mentioned in the RFC, so it's not obvious what a global config is.
Co-authored-by: Simon Ihmig <ihmig@kaliber5.de>
@@ -8,61 +8,180 @@ Traditionally, Ember addons have a lot of power to run arbitrary code during the | |||
|
|||
The [Embroider package spec](../../SPEC.md) proposes fixing this by making Ember addons much more static. But they will still need the ability to change themselves in certain ways at app compilation time. Hence this package. | |||
|
|||
This package works in both Embroider builds and normal ember-cli builds, so that addon authors can switch to this newer pattern without disruption. | |||
This package works in both Embroider and Classical builds, so that addon authors can switch to this newer pattern without disruption. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might read more consistently across the ecosystem to call these Classic builds?
|
||
## The Macros | ||
|
||
### macroCondition | ||
|
||
The `macroCondition` macro allows branch level code isolation (and deletion in the case of production builds). Generally macroConditions are viewed as a foundation macro and are combined with others marcos (detailed below) to create more complex scenarios. `macroCondition` takes a single argument which must be statically known or another macro which will compile down to a static value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combined with other macros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd have loved these docs when I recently tried to use @embroider/macros
instead of ember-compatibility-helpers
...
🙏
Not the full list of macros but a first pass on the big ones