At the moment, the ProseMirror core implicitly inserts the CSS rules it needs into the document, and so do the ProseMirror plugins that need their own CSS rules. I initially made this decision because I had found that people would have trouble manually managing CSS dependencies (as separate files), especially when the corresponding scripts were being pulled in automatically by a module system.
But now that I’m moving to less magic across the board, this is starting to chafe. It is a somewhat unpredictable DOM side effect, doesn’t work very well with shadow DOM, and has caused several people issues (see here and here).
One option would be to just have a
prosemirror.css file that you’re expected to load when you use the library. I’m moving all further UI code out of the core library, and don’t care all that much anymore if people have to load
menubar.css when they include the example menubar implementation.
Do you know of any other options that would make this more smooth, without introducing scary magic or pulling in big, invasive dependencies?