Forum Samples, Tips and Tricks

Scoped styles polyfill

mdarens
Hello all,

Recently I was compelled to adapt an existing scoped style library to work with Prince for a system we're building at my work which allows users to create/edit/reference partial templates intended for print output.

https://github.com/mdarens/scoper-prince

Caveats:

- I've successfully generated expected output with Prince 12, but this should be considered an experimental preview
- It's not published on npm yet
- The test suite isn't updated yet
- The project I forked added an extra element to the tree. I was worried about this breaking global nested selectors which used e.g. descendant combinators, flex layouts, etc so this version just puts an id on the scope container & throws an exception if it already has an id