Ionaru / easy-markdown-editor

EasyMDE: A simple, beautiful, and embeddable JavaScript Markdown editor. Delightful editing for beginners and experts alike. Features built-in autosaving and spell checking.
https://stackblitz.com/edit/easymde
MIT License
2.45k stars 319 forks source link

Struggling to make this work via NPM with purgcss #211

Open kurucu opened 4 years ago

kurucu commented 4 years ago

Describe your question Are EasyMDE classes namespaced?

What do I (can I) whitelist with PurgeCSS to get it to overlook EasyMDE? As far as I can tell, this isn't a simple task - but perhaps I'm missing something.

Ionaru commented 4 years ago

EasyMDE creates the HTML elements when the page loads, so that will probably confuse PurgeCSS. You could try adding all the classes in https://github.com/Ionaru/easy-markdown-editor/blob/master/src/css/easymde.css to the whitelist, but this can be tedious and isn't guaranteed to work with future updates.

kurucu commented 4 years ago

Hi Ionaru.

Other libraries work the same way (creates elements when instantiated) but they only have one or two namespaces or patterns to put in the passlist. (e.g. Pikaday, which starts all classes with "pika-").

kurucu commented 4 years ago

One way around it would be to add the following at the beginning and end of the EasyMDE css file:

/*! purgecss start ignore */

/*! purgecss end ignore */