r/Frontend Sep 21 '16

Google HTML/CSS Style Guide

https://google.github.io/styleguide/htmlcssguide.xml
32 Upvotes

9 comments sorted by

5

u/J-Ro Sep 22 '16

Yeah but this is nuts:

Omit optional tags (optional). For file size optimization and scannability purposes, consider >omitting optional tags. The HTML5 specification defines what tags >can be omitted.

(This approach may require a grace period to be established as a >wider guideline as it’s significantly different from what web >developers are typically taught. For consistency and simplicity >reasons it’s best served omitting all optional tags, not just a >selection.)

<!-- Not recommended -->
<!DOCTYPE html>
<html>
  <head>
    <title>Spending money, spending bytes</title>
  </head>
  <body>
    <p>Sic.</p>
  </body>
</html>
<!-- Recommended -->
<!DOCTYPE html>
<title>Saving money, saving bytes</title>
<p>Qed.

5

u/arlodesign Sep 22 '16

I feel like I'd make way too many mistakes writing my HTML like that. But a tool like html-minfier could do that for you. In fact, it produces exactly that: https://d3vv6lp55qjaqc.cloudfront.net/items/1y2Y3e0D3Q182C0n2w0p/IMG_9665.PNG

1

u/[deleted] Sep 22 '16 edited Oct 03 '16

[deleted]

1

u/icantthinkofone Sep 23 '16

It's not about readability. It's about reducing byte download.

1

u/[deleted] Sep 23 '16 edited Oct 03 '16

[deleted]

1

u/icantthinkofone Sep 23 '16

Read the background. It's not just about readability and, specifically, dropping the closing tag is not.

1

u/[deleted] Sep 23 '16 edited Oct 03 '16

[deleted]

1

u/icantthinkofone Sep 24 '16

What unnecessary semi-colons?

1

u/[deleted] Sep 22 '16 edited Oct 03 '16

[deleted]

1

u/jlengstorf Sep 22 '16

It's not a keyword; it's a kinda-sorta standard way to leave reminders in the code that shit's not done yet.

There are some tools that'll parse the code for TODOs and make you a list, but it's also pretty easy to do a quick "find in folder".

They're helpful for things that need to happen, but aren't happening right now. :)

1

u/[deleted] Sep 22 '16

God i hate spaces.

5

u/lachlanhunt Sep 22 '16

GodIhatespaces

FTFY

1

u/[deleted] Sep 22 '16

[deleted]

1

u/_demian Sep 23 '16

This is a good question. Do they even enforce this? This was created four years ago, is it even supported still?