MyBB Community Forums

Full Version: Whitespace
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone here remove whitespace from HTML, PHP, CSS, etc. when coding? I find it does make the file a lot smaller, but for readability and editing later it's a pain in the lime, so I tend to format everything with indents and new lines.

So?
I use indents a lot, blank lines, quite a bit. I don't really care about file size, the increase won't be loads.
You got to use CSS for example:

<p>text</p>

and in CSS

p {
line-height: 4px;
}

Read http://www.w3schools.com/css/css_text.asp
He's not talking about through the browser but the source code Wink.
I was forced to start compressing my files on my proxies this week. It reduces loading time, and drastically decreases bandwidth usage. I was forced to do this after going 120GB over my monthly bandwidth limit and having server load averages reach 30 :p

In addition, I just recently started using CSS Sprites.
Use 1 tab instead of 4 spaces.
(2009-12-01, 05:54 PM)NetSage Wrote: [ -> ]He's not talking about through the browser but the source code Wink.
:O my bad Blush
(2009-12-02, 06:50 AM)Dennis Tsang Wrote: [ -> ]Use 1 tab instead of 4 spaces.

Yeah if I copy a chunk of code that's indented with spaces I have to un-indent the whole thing and do it with tabs.
I tend to indent with single spaces when coding, then remove all indentation once the code is ready. I've considered removing newlines too but decided that it would be better to make it easy to upgrade.
No need to remove whitespace for PHP files unless you don't have enough server disk space.
For HTML/CSS, I'd just rely on gzip output. Lots of whitespace compresses very well anyway.

I believe there are probably apps which remove the whitespace still, if that's what you want.