Jump to content

Recommended Posts

Posted

Hey! 

I've just installed ProCache which is awesome. 

I did notice though that my <body> tag was omitted in the minified HTML output. I managed to get the body to render by adding a class to it. 

Any else had this issue before? 

Andy 

Posted

Hello Andy,

actually this is not an issue, because the body-tag, like many others, is optional and can be stripped out to reduce the markup:

Quote

body element's start tag may be omitted if the element is empty, or if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a metalinkscriptstyle, or template element.

Source: https://www.w3.org/TR/html5/syntax.html#optional-tags

Ryan's blog post about the HTML minification of ProCache: http://processwire.com/blog/posts/processwire-2.6.9-core-updates-and-new-procache-version/#major-enhancements-to-html-minify-capabilities

Regards, Andreas

  • Like 1
Posted
Quote

Certain tags can be omitted.

In my mind, the word can should be in bold here. Just because you can, doesn't mean you should. Omitting the <body> tag, whilst saving a couple of bytes opens a can of legacy worms. Older browsers will revert to quirksmode and Google Analytics 'prefers' analytics code immediately after the <body> tag. 

The module is awesome, and has shrunk down the first site we built to be so quick, the web inspector barely keeps up, but this one seems like it should be optional in ProCache to help with legacy development.

What do you think Andreas?

 

  • Like 2
Posted

Doesn't that defeat the object of having PC in the first place?

Like I said, it's awesome, but stripping <body> tag, feels wrong to me. I wonder if any other front end devs would agree?

 

  • Like 1
Posted

My opinion is simple here:

Yes some tags can be omitted, but I especially draw the line at the body.

How hard does the browser have to work in order to calculate a document with such tags omitted? 

Doesn't seem worth it for the sake of a few bytes in my honest opinion...  

  • Like 1
Posted

I agree that it should be optional. I found similar issue with input type text where "type" was removed so my CSS rules targeting input[type="text"] failed. But most cases there's a setting where you can fix such things, but of course that means you need some experience in ProCache.

As a workaround if you add a class to the body it should be kept (untested).

  • Like 2
  • 3 weeks later...
Posted

Hi @andy-jfd. Just wanted to mention for future reference that you should post ProCache-related questions to the ProCache VIP support area. If you don't have access there but have bought ProCache, please let Ryan know and I'm sure he'll be happy to add you. Thanks!

  • teppo locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...