criticalCSS icon indicating copy to clipboard operation
criticalCSS copied to clipboard

Pseudo-elements' content entities are converted

Open goodguyry opened this issue 10 years ago • 7 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.

goodguyry avatar Mar 28 '15 00:03 goodguyry

Just repro’d this in a project so :+1: 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.

zachleat avatar Nov 29 '16 15:11 zachleat

Any progress on this bug?

pacdemon avatar Mar 30 '17 19:03 pacdemon

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

garygreen avatar Jul 27 '17 19:07 garygreen

Is there a workaround to this issue?

Paul424 avatar Sep 04 '17 13:09 Paul424

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'

ghost avatar Sep 13 '17 17:09 ghost

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

goodguyry avatar Sep 13 '17 17:09 goodguyry

I'm still running into this issue. :/

jamesdbruner avatar Jun 28 '18 14:06 jamesdbruner