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

Support other plugins in keepAssets #2156

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Support other plugins in keepAssets #2156

merged 2 commits into from
Oct 22, 2024

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Oct 21, 2024

This extends the keepAssets feature in @embroider/addon-dev so that it composes nicely with other plugins.

For example, if you use a plugin that synthesizes CSS imports, it's nice for keepAssets to consume those and keep them as a real CSS files on disk when you build your addon.

This extends the keepAssets feature in `@embroider/addon-dev` so that it composes nicely with other plugins.

For example, if you use a plugin that synthesizes CSS imports, it's nice for keepAssets to consume those and keep them as a real CSS files on disk when you build your addon.
@ef4 ef4 added the enhancement New feature or request label Oct 21, 2024
@SergeAstapov
Copy link
Collaborator

@ef4 sorry if being silly here, is this smth we could document in readme.md of addon-dev package?

@ef4
Copy link
Contributor Author

ef4 commented Oct 21, 2024

Yes, good idea. The default way that this plugin is used in the v2-addon-blueprint doesn't change its public API at all, but I did also add a new optional argument. And we should probably explain this whole thing better.

@ef4 ef4 merged commit c51ca2b into main Oct 22, 2024
154 checks passed
@ef4 ef4 deleted the keep-assets-plugin-support branch October 22, 2024 13:03
@github-actions github-actions bot mentioned this pull request Oct 22, 2024
ef4 added a commit to cardstack/glimmer-scoped-css that referenced this pull request Oct 25, 2024
The rollup plugin as currently written only really works for library development, where you want to emit separate CSS files that are imported from your published JS files.

But we'll also want to use it in apps, where those apps are building with Vite (or directly with Rollup).

This PR simplifies the plugin so it just worries about emitting CSS and doesn't care exactly how that CSS gets further processed.

To make this continue to work in v2 addons, I've [adjusted the implementaiton of the keepAssets plugin](embroider-build/embroider#2156) so that it will compose nicely with a plugin like this one that emits CSS. So you'll want to update `@embroider/addon-dev` to a version that includes that PR.

In Vite, it just works with no further configuration since vite handles CSS imports out-of-the-box.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants