You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
It'd be nice if we can override existing styles in some cases.
For example, double processing the same HTML but with different CSS produce undesired styles state for some cases
Let me explain the issue I found:
I have an index.html
I store this html in database for further using. But then I needed to update some styles (remove font-weight, for example). I write style.css (version 2)
Well, inline styles win over CSS styles. And the tool respect that (not respecting that would be treated as a bug by not respecting how CSS works).
Your proposal would assume that any existing inline style is the result of a previous inlining, which seems totally specific to your own use case.
I see 2 solutions to solve that without changes in the library:
storing the original HTML in your DB (alongside the processed one, or producing the processed HTML as a derivative), which would allow you to inline your CSS version 2 on the original HTML (and that would work even if the original HTML was using a few inline styles to override CSS styles too)
doing a processing to remove existing style attribute before running the style inliner.
Hi!
It'd be nice if we can override existing styles in some cases.
For example, double processing the same HTML but with different CSS produce undesired styles state for some cases
Let me explain the issue I found:
I have an
index.html
and
style.css (version 1)
the processed HTML looks like expected:
I store this html in database for further using. But then I needed to update some styles (remove font-weight, for example). I write
style.css (version 2)
.foo { color: red; - font-weight: bold; }
Re-run processing, but got not what I expected:
because of I need exactly:
I think we should have optional parameter
bool $overrideExisting = false
inconvert
andinlineCssOnElement
methods.What do you think @tijsverkoyen ? I can PR this if you agree my idea.
The text was updated successfully, but these errors were encountered: