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

CSS-Purge didn't do anything to my test file #3

Closed bartkusa closed 10 years ago

bartkusa commented 10 years ago

I couldn't find any examples of what CSS-Purge does, so I don't know what to expect from it. I tried it out with this input file:

.test {
    color: red;
    color: blue;
    font-weight: bold;
}
.test2 {
    color: green;
}
.test2 {
    color: green;
    color: green;
}
.test {
    color: purple;
}
.invalidProperties {
    invalid:property;
}

I expected the output to be:

.test {
    font-weight: bold;
}
.test2 {
    color: green;
}
.test {
    color: purple;
}
.invalidProperties {
    invalid:property;
}

Instead, this is what CSS-Purge actually output:

.test {
    color: red;
    color: blue;
    font-weight: bold;
}
.test2 {
    color: green;
}
.test2 {
    color: green;
    color: green;
}
.test {
    color: purple;
}
.invalidProperties {
    invalid: property;
}

What should I have expected? What kinds of redundancies and duplicates is CSS-Purge supposed to find?

laurentperroteau commented 10 years ago

+1 => I don't understand, it only removes some spaces, no redundancies.

AndrewEQ commented 10 years ago

So I just tested with:

css-purge -i test.css -o test_o.css

test.css

.test {
    color: red;
    color: blue;
    font-weight: bold;
}
.test2 {
    color: green;
}
.test2 {
    color: green;
    color: green;
}
.test {
    color: purple;
}
.invalidProperties {
    invalid:property;
}

and got:

test_o.css

.test {
    color: purple;
    color: purple;
    font-weight: bold;
}
.test2 {
    color: green;
}
.invalidProperties {
    invalid: property;
}

I'm thinking for the duplicate property with different values of either retaining all the variations or using just the last one, which one sounds better?

AndrewEQ commented 10 years ago

Did you install it globally? npm install css-purge -g

AndrewEQ commented 10 years ago

Ok, I was able to replicate the issue, I'm thinking that its a dependency issue, will investigate and let y'all know...

AndrewEQ commented 10 years ago

Sorted, it was just the dependencies, thanks for reporting it in, I'll look into a dependency overhaul soon.

AndrewEQ commented 10 years ago

Resolved the duplicate rule properties.