I'm scoring an A :)

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,800
Reaction score
13
Scoring an A in YSlow! and 92/100 in PageSpeed. One thing though, PageSpeed mentions me minifying my HTML. Now their minified version obviously has the whitespace/comments removed, which saves a whopping 51kb (insane right!?) but I'm interested in actually seeing where this will take me...

So I'm wondering now, how can I minify the output of my classic ASP page without having to make it all part of a response.write or something?
 
not released yet, the only way to "minify" the damn html is to actually just get rid of all the indenting (thats the easy way out) but then it makes it a bit difficult if you need to do maintenance on the damn thing... then again. my **** is like 2 pages, so not a lot of code to do something very simple ;)
 
51K? you must have a shed-load of comments! You could run a reg-expression to remove \n, \t and comment markup, before serving the page. Not sure about asp classic, but in PHP I would use the output buffer, run the regex then flush the output.

But something isn't making sense here, you say you're already scoring a 92, so you must have gzip enabled? In that case I don't see how anything markup or text could add 51K... even if you have 400KB+ of comments...
 
Code:
if {regex(html) is USED)
{
    DeadPerson soonToBeDeadPerson = BeginHuntForPerson();
    soonToBeDeadPerson.Nuke(); 
    throw new PersonNeedsTherapyAndReconstructionException();
}

in other words

regex on html should not be done ever!!!!!!!!!!!!! :twisted::twisted::twisted::twisted:

it is pure evil..

trouble waiting to happen...

even though the \n although not an html element, rather use a parser.
 
Code:
if {regex(html) is USED)
{
    DeadPerson soonToBeDeadPerson = BeginHuntForPerson();
    soonToBeDeadPerson.Nuke(); 
    throw new PersonNeedsTherapyAndReconstructionException();
}

in other words

regex on html should not be done ever!!!!!!!!!!!!! :twisted::twisted::twisted::twisted:

it is pure evil..

trouble waiting to happen...

even though the \n although not an html element, rather use a parser.

Do you read Jeff Atwood by any chance?
 
That Jeff Atwood article is a great read.

crazy_cat, I agree that parser's are better for parsing HTML. But we're not parsing anything here, we're removing \n and \r characters (which have no closing tags). Comments may have closing tags, but this HTML is also generated by the OP - we're not scraping other websites. So I would imagine he/she has a standardized form for comment blocks, and is producing/can check that the HTML is well formed. A parser would be serious overkill.

Besides this, I still think something is wrong with the original post. If gzip is enabled, the space taken by comments and whitespace should be negligible.
 
Yea, I checked it out, it's not only comments, but actual whitespace. I indent religiously, but when I remove all indentation I save a massive amount of kb.

I don' have gzip enabled (IIS remember) AFAIK
 
Last edited:
If I were using ASP.NET I would probably have tried it thanks, but I'm using classic ASP.
 
What version of IIS are you hosting on? Do you have access to the IIS control panels (to set compression, etc.)
 
Last edited:
What version of IIS are you hosting on? Do you have access to the IIS control panels (to set compression, etc.)

Pfff, of course I have access to everything. People trust me with **** (for some reason). So I'm the sys admin and the web developer and the shoulder to cry on....

Running IIS6 on the server but IIS7 on my dev enviroment
 
Right. If you have money to throw around, there's an easy way out: ZipEnable for IIS 6.0

If you haven't got money, here's a quote for you ;):
The good news is that gzip compression is built into IIS 6.0 and is much better than the gzip compression used in IIS 5.0. Unfortunately, when attempting to turn on gzip compression in IIS 6.0, you may not be able to locate the setting on the properties dialog in IIS. The IIS team built awesome gzip capabilities into the server, but neglected to include an administrative UI for enabling it. To enable gzip compression, you have to spelunk into the innards of the XML configuration settings of IIS 6.0 (which isn't for the faint of heart).

Here's a thread on II6 Compression - the link will take you to the first helpful post.

There's apparently a great article here: http://www.dotnetdevs.com/articles/IIS6compression.aspx - for some reason I get a 404, and Google Cache doesn't want to help me, although you may have better luck.
 
Thanks, know all about it. My initial question was just how to minify the output of HTML code, and for now I'll be happy to get rid of all the indenting manually as the code is pretty straightforward and easy to maintain
 
Top
Sign up to the MyBroadband newsletter
X