LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

autoprefixer

Add vendor prefixes to CSS automatically

TLDR

Process a CSS file and add vendor prefixes
$ autoprefixer [input.css] -o [output.css]
copy
Process CSS from stdin
$ cat [input.css] | autoprefixer > [output.css]
copy
Specify browser targets
$ autoprefixer [input.css] -o [output.css] --browsers "last 2 versions, > 1%"
copy
Process multiple files in place
$ autoprefixer [file1.css] [file2.css]
copy
Generate source maps
$ autoprefixer [input.css] -o [output.css] --map
copy
Show which prefixes would be added
$ autoprefixer --info
copy

SYNOPSIS

autoprefixer [options] [files]

DESCRIPTION

Autoprefixer is a PostCSS plugin that automatically adds vendor prefixes to CSS properties based on current browser usage data. It parses CSS and adds prefixes like -webkit-, -moz-, and -ms- where needed for cross-browser compatibility.The tool uses Browserslist to determine which prefixes are needed based on target browser specifications. It not only adds required prefixes but also removes outdated ones that are no longer necessary, keeping CSS clean and efficient.Autoprefixer handles CSS properties, values, at-rules, and selectors. It understands which browsers support which features and adds only the necessary prefixes based on the specified browser targets, typically configured in a browserslist file or package.json.

PARAMETERS

-o, --output file

Write output to the specified file.
-d, --dir directory
Output to a directory (for multiple files).
--map
Generate source maps.
--no-map
Disable source map generation.
-b, --browsers list
Browser targets (Browserslist query).
--ignore pattern
Glob patterns for files to ignore.
--replace
Modify files in place (default for multiple files).
--info
Display browser list and prefixes information.
--no-inline
Do not inline source maps.
--env environment
Specify Browserslist environment.

CONFIGURATION

.browserslistrc

Defines target browsers for prefix generation using Browserslist query syntax.
postcss.config.js
PostCSS configuration file where Autoprefixer can be loaded as a plugin with options.

INSTALL

nix profile install nixpkgs#autoprefixer
copy

CAVEATS

Browser support data depends on Can I Use database updates. Very new CSS features may not be recognized immediately. The tool cannot fix non-standard browser behaviors, only add standard prefixes. Some prefixes have behavioral differences that prefixing cannot resolve.

HISTORY

Autoprefixer was created by Andrey Sitnik in 2013 as a solution to the tedious manual process of adding vendor prefixes. It became one of the most widely used PostCSS plugins and is integrated into most modern build tools including webpack, Vite, and Parcel. The tool revolutionized CSS workflow by eliminating manual prefix management using real browser usage data from caniuse.com.

SEE ALSO

postcss(1), cssnano(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid