RadValentin / postcss-prefix-selector

Prefix all CSS rules with a selector
MIT License
166 stars 16 forks source link

Transform access to Rule/Root #109

Closed luttje closed 2 years ago

luttje commented 2 years ago

In issue #108 we discussed getting access to the raw postcss Root in the transform callback. While I was working on this I realized that you can get Root from a Rule (Rule#root). Giving the user access to the current Rule therefor opens up even more options.

I have added tests that also demonstrate why this feature is useful.

If you don't mind making a breaking change I would consider removing this line: https://github.com/luttje/postcss-prefix-selector/blob/c61250e46d63f34913702253f076de72a0daa730/index.js#L47 Since that can now be reached through rule.root.source.input.file

Let me know if I need to add/change something. If you think it's all good, let me know and I'll add a bit of explanation to the README as well.

luttje commented 2 years ago

@RadValentin Separated tests and added a bit to README. Let me know if I can do anything else here.

RadValentin commented 2 years ago

Published v1.16.0 which includes the changes in this PR, thanks for contributing!

luttje commented 2 years ago

My pleasure! 👍