enovatedesign / craft-style-inliner

A Twig tag for inlining styles in a template
MIT License
7 stars 4 forks source link

Removes html entities #3

Closed Christo55 closed 5 years ago

Christo55 commented 5 years ago

Hi,

I've noticed that the inliner removes html entities. I was hoping there would be a setting one could update to keep these intact.

For example: I could have this in a twig file:

© ACME company

after viewing the inliner file in browser source view this get's changed too:

© ACME company

Non-breaking spaces are kept, but wherever I have used other entities such as   or   these are removed. This causes some problems in older email clients.

Can one add or change anything in the plugin to get it to keep the entities ?

Thanks for this plugin, Im using it to inline emails, and it works like a charm.

Christo55 commented 5 years ago

From what I can see, the problem lies with outputting the fields via twig. Doing {{title|raw}} strips the needed nbsp; from source, but without it, renders the syntax as is, also not ideal to Read "Title of my book"

Christo55 commented 5 years ago

Ive done some research and using alt + space on mac generates the correct space, which I can replace using the replace filter, and generate the   back.

leecrosdale commented 5 years ago

Hi @Christo55,

Thanks for your message, sorry for the long reply.

We actually only extend from another library in order to use that library within twig.

https://github.com/tijsverkoyen/CssToInlineStyles

I think your issue lies there in the way the css is inlined.

If I can be of anymore help, please let me know, you are also welcome to submit a PR if you find a fix!

Christo55 commented 5 years ago

Hi @leecrosdale I saw that in another thread.
Hmm ok so you are using that lib, does that mean the lib you mentioned inlines the css into style tags?

leecrosdale commented 5 years ago

Hi @Christo55 yes it should do, all our plugin does is allows that plugin to be used as a twig variable.