Skip to content

Conversation

@Sigma-dev
Copy link

@Sigma-dev Sigma-dev commented Nov 29, 2025

As a user, it kinda sucks copying a website example only to see it not working and with unhelpful rust errors.

Some examples do mention it in their description, but it's not universal and can be forgotten. It's also easy to miss.

My solution is to add a warning banner that lists out the optional feature flags that are required for the example to work (no banner if no required features).

The information is collected from the required_features specified in the root Cargo.toml of the bevy engine.
This data is not yet available to the website so I made another PR in bevy to make it available: bevyengine/bevy#21975.

EDIT: The required change has now been merged, this is ready to go

Feel free to give feedback on the wording or anything else.

This is how it would look:
image

github-merge-queue bot pushed a commit to bevyengine/bevy that referenced this pull request Dec 4, 2025
# Objective

This PR is a sister PR necessary for the website to have
`required_features` data.
You will find more information on the motivations there:
bevyengine/bevy-website#2313

## Solution

- Add the required_features data to the examples docs export

## Testing

I tested both together and it worked fine
</aside>
{% if page.extra.required_features %}
<aside class="callout callout--warning">
<h3 class="warning">Optional feature flag</h3>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think having this header text as "Optional feature flag" is confusing. If I am understanding this issue correctly the feature flag is not optional for this example, which is described with added clarity below.

Maybe "Feature flag required for example" or "Feature flag details" provide more clarity?

Copy link
Author

@Sigma-dev Sigma-dev Dec 4, 2025

Choose a reason for hiding this comment

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

I agree, I think "Feature flag required" is a better name, I will make the change

@mockersf
Copy link
Member

mockersf commented Dec 4, 2025

blocked until the 0.18 is released

@Rodhlann
Copy link
Contributor

Rodhlann commented Dec 7, 2025

I wanted to get an example of multiple feature flags being enabled before approving, just to double check the behavior. I ended up spoofing the behavior, but it works as advertised. Looks good!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants