Closed bholloway closed 6 years ago
Hi! PR is possible. But right now I see a problem in wanted CSS code. The reset block has higher specificity than implementation
Here is an example how it would work in a browser. Replaced font on color to make problem more visible http://jsbin.com/napivudoyo/edit?html,css,output
BTW reset.css could be applied to your styles anyway. And You don't need to change the behavior of this plugin to match reset.css. But usually, it is not required to use both postcss-autoreset
and reset.css on the same project.
Ah yes of course. I :facepalm: myself. I will close this.
However I am not seeing how reset.css
could be applied to my styles without potentially regressing the host page.
The best solution I can see right now is to use a subset of the reset.css
styles and apply it using postcss-autoreset
to my classes (same specificity, per the existing functionality).
You can nest the content of reset.css in the root CSS rule of your app widget. Good luck!
Thanks for this plugin!
My use case
I am generating static HTML with css modules. I will be inserting this HTML+CSS a "host" page that does not have a "reset css".
I would like to use
postcss-autoreset
on all my hashed class names, so that it is specific only to my static HTML only and does not effect my host page.However I need to match the selectors of resetcss, which include the element.
Currently supported
The class names are collated.
Before
After
What I need
An arbitrary string that I specify (e.g. "div"), prepended to the collated class names.
After
What I propose
New option
mapSelector : function
.The
mapSelector
performs a flat-map ofmatchedSelectors
before this invocation.Default value is identity function
x => x
, which gives unchanged behaviour.In my case I would use:
Would you be open to a PR that implements this?