lightningcss
lightningcss copied to clipboard
Alow manipulating `Selector` parts from consumer code
This PR needs a review and is open to renaming/tests/suggestions.
The proposed API is a logical continuation of https://github.com/parcel-bundler/lightningcss/issues/495, https://github.com/parcel-bundler/lightningcss/pull/485, and it covers a usecase of fervid project: https://github.com/phoenix-ru/fervid/blob/master/crates/fervid_css/src/transform_style_scoped.rs#L331-L337
It allows appending Selector components with bypassing the checks in https://github.com/parcel-bundler/lightningcss/blob/master/selectors/parser.rs#L718-L725
Two new helpers are added:
insert_rawfor inserting a singleComponentat an arbitrary index;insert_raw_multiplefor inserting multipleComponents at an arbitrary index.
It is a blocker to Vue <style> transformations, examples of which are here:
https://github.com/phoenix-ru/fervid/blob/master/crates/fervid_css/src/lib.rs#L92-L186