-
Hey! A not too uncommon pattern is to re-export components in a index file for shared things like:
We do this to allow more compact imports like |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Did you find a solution for this? I started experimenting with |
Beta Was this translation helpful? Give feedback.
-
I also saw there is a possibility to use
|
Beta Was this translation helpful? Give feedback.
-
Hi @hanswilw, @kelvinlouis, CSS is automatically included even if only the parts of the file it's in are used since it's considered a necessary side effect because rollup cannot understand if it's needed or not by itself. Although there are some ways to limit the used CSS:
That's one way to do it, but it is limited to Another way is to use If you had a component named styles({
exclude: ["**/components/indicator/**"]
}); ...or, on the opposite, if you wanted to include only its styles: styles({
include: ["**/components/indicator/**"]
}); Filtering is done using Hope that's made it a little bit clearer. |
Beta Was this translation helpful? Give feedback.
Hi @hanswilw, @kelvinlouis,
CSS is automatically included even if only the parts of the file it's in are used since it's considered a necessary side effect because rollup cannot understand if it's needed or not by itself.
Although there are some ways to limit the used CSS:
That's one way to do it, but it is limited to
inject
mode.Another way is to use
include
/exclude
options, e.g.:If you had a component named
indicator
insidecomponents
directory and you wanted to exclude all its styles do:...or, on the opposite, if you wanted to include only its styles: