Jump to content

Remove the white space in source code


OctoDev

Recommended Posts

Hello everyone!

 

I've noticed that IPS, have always had so much white space in the source code?

 

I suggest that the code will be optimized.This is not good for a huge premium software like IPS!

The meta tags were also broken all the way till 4.3, but it's fixed. Hopefully, all that white space can also be fixed happens on all websites using IPS - unless they enable "HTML Minify" on CloudFlare.

 

Screenshot: https://i.imgur.com/sOHMQ9G.png

Link to comment
Share on other sites

The benefits of minifying the html are minimal when considering that it's being gzipped before being sent (at least, I think so, and I think I remember it working on my server, though I haven't checked in ages).

There is a bit much whitespace though, as if it's being artificially added multiple times.

Link to comment
Share on other sites

1 hour ago, Adlago said:

In version 4.2.7 I did this and I was able to remove about 700 bytes of source code. It took me a few days

All you need is one string and you will delete all spaces in 1 min ;) 

Here is my test:

Before 108,734 bytes:

com-before.thumb.png.94d23325a3d9f79089bcc280de955892.png

After 96,058 bytes:

comp-after.thumb.png.2fd6fb21d0281c7051e6f311dca3049a.png

Saved: 12,676 bytes

Link to comment
Share on other sites

5 minutes ago, SeNioR- said:

All you need is one string and you will delete all spaces in 1 min ;) 

Here is my test:

Before 108,734 bytes:

com-before.thumb.png.94d23325a3d9f79089bcc280de955892.png

After 96,058 bytes:

comp-after.thumb.png.2fd6fb21d0281c7051e6f311dca3049a.png

Saved: 12,676 bytes

Make a speed test before and after and share

Link to comment
Share on other sites

It's not always about SEO or Speed. It's about how it should be. 

I have never seen any other forum software, or websites in general that has that many empty lines. What is the reasoning behind this?

 

I don't think there is any good explanation to why we should have extra lines in the source code. Maybe it doesn't make that much of an impact to load the page but still looks horrible. It just makes no sense, I've never seen any website have this other than IPS Forums.

 

Sadly, think a plugin would be good for many but I personally enabled CloudFlare HTML Minify. I just think this is something that should be natively supported/optimized by IPS - no plugin required. For my case; you don't need to. But if any other here would want one, why not? :) Seems like IPS Are not going to support it, as "everyone has gzip enabled on their server, or use html minify so there is no reason to optimize it."

 

21 hours ago, bfarber said:

The HTML is compressed before being sent to the browser, so the amount of whitespace in the HTML source has virtually no impact on speed or SEO.

That really depends on your server configuration. 

 

I just don't see why you guys have added this much empty space to the "page source code". It looks horrible and unprofessional. Yes, it doesn't have much of an impact regardless if you enable gzip or whatever compression - but still looks pretty bad. 

 

This looks x10 better, and yes it saves some bandwidth.

RSos4li.png

Link to comment
Share on other sites

Not really seeing much logic in your argument. You claim to know how it “should be” and then “prove” that by saying nothing else than “others don’t do that”. That’s not much of an argument for the claim. 

And it isn’t even true. Quick check with Xenforo:

721732351_Bildschirmfoto2018-03-23um12_04_58.thumb.png.80c96787c93aae1b707a01973802f6fb.png

Link to comment
Share on other sites

1 hour ago, opentype said:

Not really seeing much logic in your argument. You claim to know how it “should be” and then “prove” that by saying nothing else than “others don’t do that”. That’s not much of an argument for the claim. 

And it isn’t even true. Quick check with Xenforo:

721732351_Bildschirmfoto2018-03-23um12_04_58.thumb.png.80c96787c93aae1b707a01973802f6fb.png

My deepest apologizes. I checked their main page, not the actual forum and you are right - they have it too. That means that IPS should also have lots of useless white space in the source code.

 

I really do not understand why all that white space is even there, can anyone give me a quick explanation of the logic behind having so many new lines?

 

I've understood this already:

  • Everyone has GZIP enabled by default on their servers (Duh, no).
  • There is not much of an impact (If your internet is really slow, those extra bytes matter).
  • XenForo has it too (Okay? Still doesn't look professional to fill out the page with 10's of white space/lines that do absolutely nothing).

 

Do these white lines actually do anything good at all? Beside looking unprofessional and adding extra data to the page. Looks messy.

Link to comment
Share on other sites

We use a complex templating system to build the page output - we aren't generating static HTML files that can easily be manipulated. The template files have spaces and indentations in them for readability and ease of development purposes, and then when they are "put together" sometimes you see what you would consider extraneous space in the final output.

It would actually consume more resources to strip those spaces, because we would need to write and execute code (at run time, on every single page load) to strip them. Spaces in HTML do not matter, and frankly 99.9% of your visitors are not looking at your HTML page source. GZIP negates any performance (speed or bandwidth savings) from stripping the HTML, so really the only reason left to do it is "because I look at the HTML source and think it looks prettier without extra spaces".

By the way, here's the source code of apple.com

image.png

Link to comment
Share on other sites

8 minutes ago, bfarber said:

We use a complex templating system to build the page output - we aren't generating static HTML files that can easily be manipulated. The template files have spaces and indentations in them for readability and ease of development purposes, and then when they are "put together" sometimes you see what you would consider extraneous space in the final output.

It would actually consume more resources to strip those spaces, because we would need to write and execute code (at run time, on every single page load) to strip them. Spaces in HTML do not matter, and frankly 99.9% of your visitors are not looking at your HTML page source. GZIP negates any performance (speed or bandwidth savings) from stripping the HTML, so really the only reason left to do it is "because I look at the HTML source and think it looks prettier without extra spaces".

By the way, here's the source code of apple.com

image.png

 

I must admit, I've been living in a nutshell. I've only taken the initiative to look at my own forum, but when you mention it - I notice more and more websites have this. It's just, odd. The only reason why I did take a look at it, was because the meta tags were broken on 4.2 but fixed in 4.3, so I had to take a look and see why. Which was when I noticed the enormous use of new lines.

Link to comment
Share on other sites

To be clear, we are not opposed to targeted clean up - for example, we've cleaned up the meta 'description' tag a bit for 4.3 (to allow longer descriptions, but also to clean up the spacing and special characters in the value). As for the rest of the HTML source code, however, you will generally use more resources to strip the space, and it doesn't net you any real benefits at the end of the day, so it's just not worth it. 

I've been investigating support for brotli page compression (not for 4.3, however) which would likely be a better solution to the concern than spending time writing algorithms to strip the spaces in the page source.

If this is a big concern for you regardless, you could always use Tidy in PHP to clean the output (note that it adds overhead by its nature).

Link to comment
Share on other sites

36 minutes ago, bfarber said:

To be clear, we are not opposed to targeted clean up - for example, we've cleaned up the meta 'description' tag a bit for 4.3 (to allow longer descriptions, but also to clean up the spacing and special characters in the value). As for the rest of the HTML source code, however, you will generally use more resources to strip the space, and it doesn't net you any real benefits at the end of the day, so it's just not worth it. 

I've been investigating support for brotli page compression (not for 4.3, however) which would likely be a better solution to the concern than spending time writing algorithms to strip the spaces in the page source.

If this is a big concern for you regardless, you could always use Tidy in PHP to clean the output (note that it adds overhead by its nature).

It's more my OCD.

I solved this issue by enabling HTML minify in CloudFlare. 

Link to comment
Share on other sites

39 minutes ago, silenceheaven said:

What about a JS combiner or something like AMD for all the files that stack up on a website.

 

This is another thing to do. But I don't know if this is possible because IPS has a lot of JS files and each of them is needed for something else.

combinate.thumb.jpg.b35e474655baf618ab9a78e195aac804.jpg

But that such optymalize would be great???

 

Link to comment
Share on other sites

Just now, SeNioR- said:

 

This is another thing to do. But I don't know if this is possible because IPS has a lot of JS files and each of them is needed for something else.

combinate.thumb.jpg.b35e474655baf618ab9a78e195aac804.jpg

But such optimization would be useful ???

 

At the very least, a way within applications to have your JS/CSS files combined together without a hacky solution, since having 10 addons with a bunch of styles/scripts gets big quick.

Link to comment
Share on other sites

@silenceheaven Personally, I think that one large CSS file is better than a few smaller ones. 

Basically.. in IPS there are no small output files, there are only those "big". ?? I know that it depends what is best in case by case basis, what kind of site we are and how we are built it. But in IPS, we edit CSS / JS in ACP so... 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...