danschultzer / premailex

Preflight for your HTML emails - inline styling and plain text.
MIT License
172 stars 20 forks source link

Any interest in these changes? #8

Closed willbarrett closed 6 years ago

willbarrett commented 6 years ago

Hi! I needed to inline some CSS on an elixir project, and ran into a couple of issues with premailer - whitespace wasn't being retained, I couldn't specify which CSS element to inline, and the inlined CSS remained in the head of the document. These are somewhat-breaking changes, so I wasn't sure if you were interested in including them in mainline. You can see the work I did here:

https://github.com/change/premailex/pull/1

Feedback would be awesome. I'm happy to open a PR against this repo if these are changes you'd be interested in!

danschultzer commented 6 years ago

I'm definitely interested in a PR @willbarrett. It looks good though I would prefer a pure Elixir version so users aren't required to have rust installed. I do understand that meeseeks have better html5 support so we might have to just work with that for now. I would also like to see a test case for the whitespace issue so we can be sure any future changes won't break it.

Feel free to open a PR, I'm a bit busy until the end of this week but then I'll be able to take a proper look at it. Thanks!

willbarrett commented 6 years ago

Thanks Dan! I'll open a PR in a bit - I'm still poking at it. I'd prefer a pure Elixir version as well but I wasn't able to find another pure elixir/erlang parser out there. The Rust version had an easier install path than the C parsers I found. Any suggestions for libraries I might have missed? I do have one idea about integrating a kludge to make Floki respect whitespace, but I'm not sure how that'll go.

danschultzer commented 6 years ago

Yeah, I've been on the lookout too, but I haven't found any good alternative. A compromise might be that meeseeks will be used if rust is installed, or otherwise it'll default to plain Floki. I guess it'll be easier to figure out with a PR and some test cases that can highlight the issue.

willbarrett commented 6 years ago

Yup. I'll have something up today or tomorrow that highlights the problems.