filamentgroup / criticalCSS

Finds the Above the Fold CSS for your page, and outputs it into a file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pseudo-elements' content entities are converted

goodguyry opened this issue · comments

Using criticalCSS via the Grunt task, I noticed entities in pseudo-elements' content property are being converted to their associated special characters and, thus, failing to render until the external CSS file has been parsed.

screen shot 2015-03-27 at 5 34 00 pm

Opening here because it doesn't seem particularly relevant to the Grunt task. Apologies if that's not the case. Let me know if you need additional information.

Just repro’d this in a project so 👍 from me.

image

turned into:
image

I’d also vote to keep the single colon :after and :before too, since they have a little bit better browser compat but that nit is not a big deal.

Any progress on this bug?

Wow, bug for 2 years? This is still a problem, just tried with CLI and fontawesome is getting converted. It should keep the value like content: "\f002";

image

Is there a workaround to this issue?

Unescaping and outputting as utf8 wouldn't be a problem. If only the quotes around it would be preserved.

For now, my workaround is using a regex-replace on the file afterwards. To place quotes around unquoted single-character content: strings in the unicode private use area that fontawesome seemingly uses:

search: /(content:\s*)([\uf000-\uf300])(\s*;)/g
replace: '$1"$2"$3'

I had a similar RegEx fix in place, but ultimately decided that was silly and switched to a different critical css package 🤐

commented

I'm still running into this issue. :/