rbtech / css-purge

A CSS tool written in Node JS as a command line app or library for the purging, burning, reducing, shortening, compressing, cleaning, trimming and formatting of duplicate, extra, excess or bloated CSS.
http://rbtech.github.io/css-purge
MIT License
125 stars 19 forks source link

Proposal: remove default browser properties #20

Closed gamegee closed 6 years ago

gamegee commented 6 years ago

First of all, thanks for this amazing package :) Css-purge check for unused properties, what if it also check for useless default properties:

e.g.

.example1 {
  text-align: left; // default in all browser --> remove
}
.example2 {
  color: #000000; // default in all browser --> remove
}

and so on..

AndrewEQ commented 6 years ago

You're welcome man.

Which properties are default in all the browsers?

Are you thinking about using a "CSS reset"?

gamegee commented 6 years ago

for example, above I use an example with the text color. By default all browsers use the black (#000000) as a default color.

It result in a useless duplication of the property color.

But after some research I think it's complex to remove such properties because an HTML element can have styles from multiple CSS classes.

AndrewEQ commented 6 years ago

To "remove it" or shorten it, I would have to add CSS somewhere, so I'm sure you're thinking of a CSS reset in terms of standardising the defaults across browsers: https://cssreset.com/scripts/eric-meyer-reset-css

In which case, you would just need to include something like the reset mentioned above into your project, then run your project through CSS-PURGE as usual.