Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3315634
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:22:24+00:00 2026-05-17T22:22:24+00:00

Minimizing html is the only section on Google’s Page Speed where there is still

  • 0

Minimizing html is the only section on Google’s Page Speed where there is still room for improvement.

My site is all dynamic and the HTML is already Deflated so there is no reason to put any more pressure on the server (I don’t want to minimize pages real time before sending).

What I could do was to minimize the template files. My templates files are a mix of PHP and HTML so I’ve come up with some code that I think is pretty safe but would like to be community revised.

// this will loop trough all template files
// php is cleaned first so that line-comments will not interfere with the regex
$original = file_get_contents($dir.'/'.$file);
$php_clean = php_strip_whitespace($dir.'/'.$file);
$minimized = preg_replace('/\s+/', ' ', $php_clean);

This will make my template files as a single very long file alternated with some places where DB content is inserted. Google’s homepage source looks more or less like what I get so I wonder if they follow a similar approach.

Question 1: Do you antecipate potencial problems?
Question 2: Is there anyway better (more efficient to do this)?

And please remember that I’m not trying to validate HTML as the templates are not valid HTML (header and footer are includes, for example).

Edit: Do take into consideration that the template files will be minimized on deploy. As CSS and Javascript files are minimized and compressed using YUI Compressure and Closure, the template files would be minimized like-wise, on deploy. Not on client-request.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:22:25+00:00Added an answer on May 17, 2026 at 10:22 pm

    I’ve been running tests on all my sites for a couple of weeks and I can say that this method is pretty consistent. It will only affect template content, so there is little risk of messing up with unknown <pre> or similar.

    It is run before deploy so there is no impact on server – actually there should be a little speed up as the file becomes smaller.

    Do remember that all content that comes from the database will not suffer any influence as, like said before, this runs before deploy and on template files only.

    The method seams solid enough to pass it into production.

    If anything goes wrong I’ll post it here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these webapplications build in old style HTML, including [framesets] to speed up
im doing a little reasearch about minimalizing the html from php. like class themeing
I have heard of the concept of minimizing code and maximizing data, and was
I want to prevent the user from maximizing the Windows Form to full screen
I'm working with JInternalFrame's under Mac OS X Java 5 and when maximizing a
I am developing an iPhone application where I need to provide an animation which
I have a custom QWidget and I simple don't want it to show up
The popup that gets opened in my app always stays on top. It goes
I am using the build in JSON class in Scala 2.8 to parse JSON
I have a strait forward aggregator/minimizer/cacher I've written in node.js. It works quite well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.