View Single Post
Old 02-07-2024, 08:22 PM   #43
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,119
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Here is an example of what I would call code bloat:
Code:
<p style="margin:0.00% 0.00%; text-indent:1.2em; line-height:110%; widows:0; orphans:0;
          font-size:1.0rem"> <span style=" font-size:1.0rem">We weren’t.</span> </p>
<p style="margin:0.00% 0.00%; text-indent:1.2em; line-height:110%; widows:0; orphans:0;
          font-size:1.0rem"> <span style=" font-size:1.0rem">We’d planned the general
          strategy weeks ago, and confirmed it days before.</span> </p>
Excerpted from On the Shoulders of Titans by Andrew Rowe, Published in 2018. I added line-breaks so you could easily see it here.

Inline styling makes me shudder anyway, but the fact that the same styling is put on EVERY FREAKING LINE... that is totally unnecessary...and bloats the code. The same goes for putting a span, with inline styling, around every paragraph simply to tell it to use the standard font size.... which it already told it in the first set of styling!

Here is what I would reduce it to:
Code:
CSS:
p {margin:0.00% 0.00%; text-indent:1.2em; line-height:110%; widows:0; orphans:0;
   font-size:1.0rem}

HTML:
<p>We weren’t.</p>
<p>We’d planned the general strategy weeks ago, and confirmed it days before.</p>
Yes Jon, we know you don't like that styling and would change it. The point here is that it doesn't change the author's/publisher's styling at all...it just reduces code bloat.

Which is easier to read? If you needed to edit the way all your paragraphs looked you would need to change every single paragraph the way it currently stands. Reducing the code bloat and using css, as in the second example, I only need to make the change in one place and it updates the whole book.

I don't really expect the code bloat to change the file size all that much...certainly not as much as fixing the images/fonts...although I have reduced massive books by a couple of megabytes. I would rather not put ANY renderer, no matter how capable, through the constant headache of crunching through all that bloat just to determine what and how it should be displayed... my phone seems to stay cooler and the battery lasts longer. (That's my story and I'm sticking to it! )


Cleaning up the unused css styles is automagically done for me when I use the Sigil plugin cssRemoveUnusedSelectors, so I don't spend too much time and energy cleaning up that "bloat".
Turtle91 is online now   Reply With Quote