-
Notifications
You must be signed in to change notification settings - Fork 31
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
Finalize v1.0 with @component tag #12
Conversation
I like the concept. I am naming TBD on I think there is also a use-case for hoisting just one global |
Updated with feedback from RFC call, mainly:
|
Updated to remove conflict with #26 RFC proposed behavior around |
If ' {
"exports": {
".": {
"import": "./dist/open-props.module.js",
"style": "./open-props.min.css"
}
}
} Or is that out of scope? |
I'm not sure I follow, but the idea would be that we would support whatever Vite supports. So if you do The goal here would be to match what would happen in any other CSS file that Vite is bundling today. For example, if you |
Literally the It did not work for me when I tested it in the latest Astro, because Vite uses Another workaround export had to be added. reference |
Ah gotcha, no I just assumed Vite still fell back to Looking at that package.json more, and I think the author actually intentionally wants you to do But even if we assume this to be incorrect behavior of Vite, this specific case is intentional in this RFC: Using Vite to handle resolution in all cases is proposed as objectively better than using Vite to handle resolution in some cases AND using some custom implementation that we've built ourselves in others. |
Correct. That was the workaround. The two links are to different versions. I was asking the question because CSS import resolution via exports seemed like undefined behavior. Maybe it’s just something to call out. Vite can resolve, but resolving styles as a kind of export is undefined behavior. I would be very comfortable with something like that. What do you think? |
``` | ||
|
||
- Pro: No user has an expectation about how this would work. That means less conflict with how `<style>` and `<script>` are expected to work. | ||
- Con: Requires extra import boilerplate in every component. We could make these globally available to mitigate, but we've never done that before. |
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.
We have one global component, Fragment
. I think the primary problem with a Component is that it can be renamed (const MyStyle = Style
) and its hard to warn against doing that.
Not much to add, 👍 overall, would love to bikeshed on the name but that can come later. |
I'd love to continue this convo outside of this RFC, since that is already the behavior of a CSS import in Astro today, and this RFC isn't meaning to change anything about that behavior. This line was only added to clarify how resolved CSS imports work today to the reader. I'll make an edit to clarify this in the RFC. |
The distinction between layouts and components really feels like an important one here with regards to the default behavior I could see it making sense to say layouts would default to not scoping, for example, but components really probably want scoping by default. In either case, default behavior for preprocessing like SASS may be a project-wide default where if I use SASS I'd expect both layouts and components to be run through SASS If we end up with special behavior for the |
One other thought here, the idea of an all-or-nothing approach to the style/script processing magic could be either a bit limiting or cumbersome if we end up with a long list of custom attributes to disable each step of the magic i.e. the RFC allows for I know the idea of something similar to |
Thoughts about #12
|
This can't be supported in SSR due to the fact that it makes those style tags be runtime dynamic. So we could never optimize these styles and bundle them. If we had a lighter weight way to do scoping (rather than running PostCSS through Vite) so that it could be done at runtime then perhaps define:vars + scoping could be done together. For that I would propose an opt-in way to do scoping ( |
3433db4
to
bd4561e
Compare
Hey all, thanks again for the feedback! I'm going to go ahead and split this into two RFCs which should hopefully make it easier to discuss. I'll make sure all feedback here is carried into those PRs so that nothing is lost. |
This reverts commit bd4561e.
New RFC, focused only on behavior: #41 |
Summary
Abandoned.
Links