Melda S
Melda S

Reputation: 141

Comment out unused CSS when developing your own template?

I am building my own template in OpenCart by making a copy of the default one and then making my own.

When I edit the CSS in Chrome code inspector and copy it to my stylesheet. Is it "correct" (from a web standards/web developer view) to leave the old commented code in place or should it be completely removed.

I sometimes find that unticking features in code inspector and then copying over the block of code from the Chrome stylesheet is the quickest and easiest way of doing things.

Or maybe there are better "Live CSS" tools and extensions out there?

Upvotes: 0

Views: 86

Answers (2)

user3369753
user3369753

Reputation:

It should ideally be removed (and then minified et cetera as mentioned by another answer). Best practice would be to use some version control software such as Git to keep track of what is removed and added and so forth.

Upvotes: 0

CodingWithSpike
CodingWithSpike

Reputation: 43698

When you deploy for production you should remove comments, and also minify your CSS. You can add a minification tool to your build process which would remove the comments and whitespace for you.

The reason is that it makes a smaller file for the end user to download. Smaller file means less bandwidth use and a faster transfer. This is especially important for mobile device users.

Upvotes: 0

Related Questions