zachleat / postcss-foft-classes

A postcss plugin to automatically add classes for various font loading strategies.
MIT License
90 stars 4 forks source link

preserve source map location for added rules and declarations #3

Closed leereamsnyder closed 6 years ago

leereamsnyder commented 6 years ago

This makes the source map output for this plugin's changes a little nicer. Without it, in dev tools you'll see that the added rules have <no source>:

screen shot 2018-03-23 at 9 01 16 pm

However, with this change, we get the correct original source of the font-family declaration:

screen shot 2018-03-23 at 8 59 04 pm

The technique for preserving the source or cloning elements comes right out of the PostCSS API documentation: http://api.postcss.org/Node.html#source

Thanks for making this plugin!

zachleat commented 6 years ago

Thank you!

zachleat commented 6 years ago

Included with 1.0.4