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

Update @embroider/macros examples in the readme #554

Merged
merged 3 commits into from
Oct 21, 2020

Conversation

thoov
Copy link
Collaborator

@thoov thoov commented Sep 25, 2020

Not the full list of macros but a first pass on the big ones

Copy link
Collaborator

@simonihmig simonihmig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

packages/macros/README.md Outdated Show resolved Hide resolved
packages/macros/README.md Show resolved Hide resolved
packages/macros/README.md Show resolved Hide resolved

### 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).
Copy link
Collaborator

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.

thoov and others added 2 commits September 29, 2020 00:43
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.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combined with other macros

Copy link
Collaborator

@rwjblue rwjblue left a 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...

🙏

@ef4 ef4 merged commit ade1133 into embroider-build:master Oct 21, 2020
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

Successfully merging this pull request may close these issues.

5 participants