nDmitry / grunt-autoprefixer

Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. Based on Autoprefixer.
MIT License
795 stars 60 forks source link

Not working well with prefixes at the top #28

Closed henryruhs closed 10 years ago

henryruhs commented 10 years ago

Hello,

your autoprefixer does not work well with prefixes at the very top of a class, it does not detect / remove it at all:

.class
{
    -moz-box-shadow: 0 0 1em rgba(0, 0, 0, 0.2);
    -webkit-box-shadow: 0 0 1em rgba(0, 0, 0, 0.2);
    color: #000;
    box-shadow: 0 0 1em rgba(0, 0, 0, 0.2);
}

Thanks for this script anyway...

ai commented 10 years ago

Yeap, API search prefixes only near by, because write prefixed and unprefixed version is common case.

ai commented 10 years ago

I can change logic, but I make Autoprefixer much compilcated inside, it weill be bad for code climate. So, why you have this code and is this code style popular?

henryruhs commented 10 years ago

Okay, it should be in your documentation - first I wondered your script is not working.

Please think about "complete" removing all vendor prefixes with the "none" option or "another name", even those who are not near by their original declaration. Is this possible?

ai commented 10 years ago

Please, open issue in and I will add note to docs: https://github.com/ai/autoprefixer

Or just send PR.

ai commented 10 years ago

Everything is possible in IT, but for what cost? ;)

Some users write:

a {
    -webkit-box-shadow: 0 0 -webkit-calc(1em + 1px) black;
    box-shadow: 0 0 calc(1em + 1px) black;
    -webkit-box-shadow: 0 0 1% black;
    box-shadow: 0 0 1% black;
}

So one rule can contain different properies with one name. So i try to group it. In your CSS Autoprefixer will fint two groups of box-shadow.

Some users need to write hacks for browsers:

a {
    -moz-transform: translate3d(0, 0, 0)
}

Autoprefixer understand that group is hack if group doesn’t have unprefixed property. Of cource, Autoprefixer willn’t remove this hacks.

henryruhs commented 10 years ago

I understand this, but it does not help people with tons of CSS that has to be manually cleaned before using autoprefixer. Anyway thanks.

ai commented 10 years ago

Of cource, I can extend logic but I will spend my weekend on this task and it will make Autoprefixer code much compilcated. So fixes will require some “payment”.

What we will get for this payment? Does this code style popular? Not, it is bad CSS style, of cource, prefixes must be near unprefixed version to good readability.

Does this outdated prefixers will broke your styles? Nope. This issue doesn’t have any side effects for interface.

So payment doesn’t give for us any value to justify payment.

ai commented 10 years ago

grunt-autoprefixer is just a Grunt wrap for autoprefixer. Autoprefixer works in Gulp, Compass, Rails and many other systems.

I ask you to create issue in main repo, because this repo isn’t mine and I can forget about this issue.

henryruhs commented 10 years ago

Thanks, closing this issue now.

nDmitry commented 10 years ago

@ai consider a warning to stdout/stderr for such cases (with line numbers). It's better to let users know if something possibly went wrong.