10

I got a CSS file which has so many vendor-prefixes (-webkit -moz etc).

And those vendor-prefixes makes the file much bigger.

I cannot remove vendor prefix one by one, Because it can take a lot of time. Is there any tools or tricks to remove vendor-prefixes from entire with one click?

Mohammad Ayoub Khan
  • 2,422
  • 19
  • 24
Jackwin tung
  • 319
  • 4
  • 9

4 Answers4

8

A nice feature of Autoprefixer is that it also removes unneeded prefixes from your CSS. You can try it online here:

http://autoprefixer.github.io/

To remove all prefixes, leave the "Filter" textbox at the bottom empty.

Richie Bendall
  • 7,738
  • 4
  • 38
  • 58
Sphinxxx
  • 12,484
  • 4
  • 54
  • 84
8

@Sphinxxx's last 1 version answer is, as stated, only “almost” correct. To remove all vendor prefixes, set the Autoprefixer filter to >100% instead.

Rafe Goldberg
  • 156
  • 2
  • 10
1

I was facing the same problem,
I was trying to remove all browser vendor prefixes from entire file at a time. I found an awesome tool postcss-remove-prefixes. Which did my work easily in just seconds.



You can find this tool here postcss-remove-prefix

I assume that you have installed NodeJs and NPM on your system.

Here is the process to use this tool
npm i -g postcss-remove-prefixes

Then use this tool from CMD as
remove-prefixes input.css
This will remove Vendor prefixes from your file

remove-prefixes input.css output.css
This will remove Vendor prefixes from your file and generates output as new file.

:) Enjoy

Mohammad Ayoub Khan
  • 2,422
  • 19
  • 24
-1

This javascript function I hosted on github does what you're looking for.
var t = DeVendorCSS("transform") returns, for example, in a webkit browser without "transform" support, but with prefixed support, an array ["webkit", "webkitTransform", "-webkit-transform"] for use in inline CSS rules, such as e.style[t[1]]="translateY(5px)". The actual value "translateY" has to be compatible cross-vendor for this to work in this example (though, if not, get funky with the vendor id given as t[0]).

CheeseFrog
  • 49
  • 2