2

Our loading crew is using different WYSIWYG HTML editors to prepare an offers. Unofrtunatelly the result code is usually not optimized and it demands a lot of space in our db.

Example codes:

<ul style="font-size: 13.3333px;">
    <li><span style="font-size: 10pt;">qwe</span></li>
    <li><span style="font-size: 10pt;">asd</span></li>
    <li><span style="font-size: 10pt;">zxc</span></li>
    <li><span style="font-size: 10pt;">qwer</span></li>
    <li><span style="font-size: 10pt;">asdf</span></li>
</ul>

or

<span style="font-size: 13.3333px;">lorem</span>
<div style="font-size: 13.3333px;"><br></div>
<div style="font-size: 13.3333px;">ipsum</div>

is there any useful lib/script which can optimize those styles before saving it to db?

Michal_Szulc
  • 4,097
  • 6
  • 32
  • 59

1 Answers1

0

So it looks like it's the inline styles that you'd like to get rid of. There's an online tool called HTML cleaner that can do this for you: HTML Cleaner Remove Inline Styles.

Dvaeer
  • 146
  • 7
  • And just as a thought, rather than doing this yourself, could educating your loading crew work? – Dvaeer Mar 30 '18 at 12:25
  • It's not a matter of education, an WYSIWYG HTML editor is a graphical editor to generate HTML. – Winter Mar 30 '18 at 12:27
  • Yes, you're right @Winter. But I was thinking the loading crew could run the code their WYSIWYG editors generates through an HTML cleaner, before they submit it. Maybe a small extra step for them? – Dvaeer Mar 30 '18 at 12:33
  • The problem is that I do not want to get rid off all the styles. I want to remove redundant ones, as I stated in the title. I've checked html-cleaner.com but unfortnatelly it's removing *all* the inline styling. – Michal_Szulc Mar 30 '18 at 13:39