Git Product home page Git Product logo

autoprefixer's Introduction

Autoprefixer Cult Of Martians

PostCSS plugin to parse CSS and add vendor prefixes to CSS rules using values from Can I Use. It is recommended by Google and used in Twitter and Alibaba.

Write your CSS rules without vendor prefixes (in fact, forget about them entirely):

::placeholder {
  color: gray;
}

.image {
  background-image: url([email protected]);
}
@media (min-resolution: 2dppx) {
  .image {
    background-image: url([email protected]);
  }
}

Autoprefixer will use the data based on current browser popularity and property support to apply prefixes for you. You can try the interactive demo of Autoprefixer.

::-moz-placeholder {
  color: gray;
}
::placeholder {
  color: gray;
}

.image {
  background-image: url([email protected]);
}
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 2dppx) {
  .image {
    background-image: url([email protected]);
  }
}

Twitter account for news and releases: @autoprefixer.

Sponsored by Evil Martians

Contents

Browsers

Autoprefixer uses Browserslist, so you can specify the browsers you want to target in your project with queries like > 5% (see Best Practices).

The best way to provide browsers is a .browserslistrc file in your project root, or by adding a browserslist key to your package.json.

We recommend the use of these options over passing options to Autoprefixer so that the config can be shared with other tools such as babel-preset-env and Stylelint.

See Browserslist docs for queries, browser names, config format, and defaults.

FAQ

Does Autoprefixer polyfill Grid Layout for IE?

Autoprefixer can be used to translate modern CSS Grid syntax into IE 10 and IE 11 syntax, but this polyfill will not work in 100% of cases. This is why it is disabled by default.

First, you need to enable Grid prefixes by using either the grid: "autoplace" option or the /* autoprefixer grid: autoplace */ control comment. Also you can use environment variable to enable Grid: AUTOPREFIXER_GRID=autoplace npm build.

Second, you need to test every fix with Grid in IE. It is not an enable and forget feature, but it is still very useful. Financial Times and Yandex use it in production.

Third, there is only very limited auto placement support. Read the Grid Autoplacement support in IE section for more details.

Fourth, if you are not using the autoplacement feature, the best way to use Autoprefixer is by using grid-template or grid-template-areas.

.page {
  display: grid;
  grid-gap: 33px;
  grid-template:
    "head head  head" 1fr
    "nav  main  main" minmax(100px, 1fr)
    "nav  foot  foot" 2fr /
    1fr   100px 1fr;
}
.page__head {
  grid-area: head;
}
.page__nav {
  grid-area: nav;
}
.page__main {
  grid-area: main;
}
.page__footer {
  grid-area: foot;
}

See also:

Does it add polyfills?

No. Autoprefixer only adds prefixes.

Most new CSS features will require client side JavaScript to handle a new behavior correctly.

Depending on what you consider to be a “polyfill”, you can take a look at some other tools and libraries. If you are just looking for syntax sugar, you might take a look at:

  • postcss-preset-env is a plugins preset with polyfills and Autoprefixer to write future CSS today.
  • Oldie, a PostCSS plugin that handles some IE hacks (opacity, rgba, etc).
  • postcss-flexbugs-fixes, a PostCSS plugin to fix flexbox issues.

Why doesn’t Autoprefixer add prefixes to border-radius?

Developers are often surprised by how few prefixes are required today. If Autoprefixer doesn’t add prefixes to your CSS, check if they’re still required on Can I Use.

Why does Autoprefixer use unprefixed properties in @-webkit-keyframes?

Browser teams can remove some prefixes before others, so we try to use all combinations of prefixed/unprefixed values.

How to work with legacy -webkit- only code?

Autoprefixer needs unprefixed property to add prefixes. So if you only wrote -webkit-gradient without W3C’s gradient, Autoprefixer will not add other prefixes.

But PostCSS has plugins to convert CSS to unprefixed state. Use postcss-unprefix before Autoprefixer.

Does Autoprefixer add -epub- prefix?

No, Autoprefixer works only with browsers prefixes from Can I Use. But you can use postcss-epub for prefixing ePub3 properties.

Why doesn’t Autoprefixer transform generic font-family system-ui?

system-ui is technically not a prefix and the transformation is not future-proof. You can use postcss-font-family-system-ui to transform system-ui to a practical font-family list.

Usage

Gulp

In Gulp you can use gulp-postcss with autoprefixer npm package.

gulp.task('autoprefixer', () => {
  const autoprefixer = require('autoprefixer')
  const sourcemaps = require('gulp-sourcemaps')
  const postcss = require('gulp-postcss')

  return gulp.src('./src/*.css')
    .pipe(sourcemaps.init())
    .pipe(postcss([ autoprefixer() ]))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('./dest'))
})

With gulp-postcss you also can combine Autoprefixer with other PostCSS plugins.

Webpack

In webpack you can use postcss-loader with autoprefixer and other PostCSS plugins.

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader", "postcss-loader"]
      }
    ]
  }
}

And create a postcss.config.js with:

module.exports = {
  plugins: [
    require('autoprefixer')
  ]
}

CSS-in-JS

The best way to use PostCSS with CSS-in-JS is astroturf. Add its loader to your webpack.config.js:

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ['style-loader', 'postcss-loader'],
      },
      {
        test: /\.jsx?$/,
        use: ['babel-loader', 'astroturf/loader'],
      }
    ]
  }
}

Then create postcss.config.js:

module.exports = {
  plugins: [
    require('autoprefixer')
  ]
}

CLI

You can use the postcss-cli to run Autoprefixer from CLI:

npm install postcss postcss-cli autoprefixer
npx postcss *.css --use autoprefixer -d build/

See postcss -h for help.

Other Build Tools

Preprocessors

GUI Tools

JavaScript

You can use Autoprefixer with PostCSS in your Node.js application or if you want to develop an Autoprefixer plugin for a new environment.

const autoprefixer = require('autoprefixer')
const postcss = require('postcss')

postcss([ autoprefixer ]).process(css).then(result => {
  result.warnings().forEach(warn => {
    console.warn(warn.toString())
  })
  console.log(result.css)
})

There is also a standalone build for the browser or for a non-Node.js runtime.

You can use html-autoprefixer to process HTML with inlined CSS.

Text Editors and IDE

Autoprefixer should be used in assets build tools. Text editor plugins are not a good solution, because prefixes decrease code readability and you will need to change values in all prefixed properties.

I recommend you to learn how to use build tools like Parcel. They work much better and will open you a whole new world of useful plugins and automation.

If you can’t move to a build tool, you can use text editor plugins:

Warnings

Autoprefixer uses the PostCSS warning API to warn about really important problems in your CSS:

  • Old direction syntax in gradients.
  • Old unprefixed display: box instead of display: flex by latest specification version.

You can get warnings from result.warnings():

result.warnings().forEach(warn => {
  console.warn(warn.toString())
})

Every Autoprefixer runner should display these warnings.

Disabling

Prefixes

Autoprefixer was designed to have no interface – it just works. If you need some browser specific hack just write a prefixed property after the unprefixed one.

a {
  transform: scale(0.5);
  -moz-transform: scale(0.6);
}

If some prefixes were generated incorrectly, please create an issue on GitHub.

Features

You can use these plugin options to control some of Autoprefixer’s features.

  • grid: "autoplace" will enable -ms- prefixes for Grid Layout including some limited autoplacement support.
  • supports: false will disable @supports parameters prefixing.
  • flexbox: false will disable flexbox properties prefixing. Or flexbox: "no-2009" will add prefixes only for final and IE versions of specification.
  • remove: false will disable cleaning outdated prefixes.

You should set them inside the plugin like so:

autoprefixer({ grid: 'autoplace' })

Control Comments

If you do not need Autoprefixer in some part of your CSS, you can use control comments to disable Autoprefixer.

.a {
  transition: 1s; /* will be prefixed */
}

.b {
  /* autoprefixer: off */
  transition: 1s; /* will not be prefixed */
}

.c {
  /* autoprefixer: ignore next */
  transition: 1s; /* will not be prefixed */
  mask: url(image.png); /* will be prefixed */
}

There are three types of control comments:

  • /* autoprefixer: (on|off) */: enable/disable all Autoprefixer translations for the whole block both before and after the comment.
  • /* autoprefixer: ignore next */: disable Autoprefixer only for the next property or next rule selector or at-rule parameters (but not rule/at‑rule body).
  • /* autoprefixer grid: (autoplace|no-autoplace|off) */: control how Autoprefixer handles grid translations for the whole block:
    • autoplace: enable grid translations with autoplacement support.
    • no-autoplace: enable grid translations with autoplacement support disabled (alias for deprecated value on).
    • off: disable all grid translations.

You can also use comments recursively:

/* autoprefixer: off */
@supports (transition: all) {
  /* autoprefixer: on */
  a {
    /* autoprefixer: off */
  }
}

Note that comments that disable the whole block should not be featured in the same block twice:

/* How not to use block level control comments */

.do-not-do-this {
  /* autoprefixer: off */
  transition: 1s;
  /* autoprefixer: on */
  transform: rotate(20deg);
}

Options

Function autoprefixer(options) returns a new PostCSS plugin. See PostCSS API for plugin usage documentation.

autoprefixer({ cascade: false })

Available options are:

  • env (string): environment for Browserslist.
  • cascade (boolean): should Autoprefixer use Visual Cascade, if CSS is uncompressed. Default: true
  • add (boolean): should Autoprefixer add prefixes. Default is true.
  • remove (boolean): should Autoprefixer [remove outdated] prefixes. Default is true.
  • supports (boolean): should Autoprefixer add prefixes for @supports parameters. Default is true.
  • flexbox (boolean|string): should Autoprefixer add prefixes for flexbox properties. With "no-2009" value Autoprefixer will add prefixes only for final and IE 10 versions of specification. Default is true.
  • grid (false|"autoplace"|"no-autoplace"): should Autoprefixer add IE 10-11 prefixes for Grid Layout properties?
    • false (default): prevent Autoprefixer from outputting CSS Grid translations.
    • "autoplace": enable Autoprefixer grid translations and include autoplacement support. You can also use /* autoprefixer grid: autoplace */ in your CSS.
    • "no-autoplace": enable Autoprefixer grid translations but exclude autoplacement support. You can also use /* autoprefixer grid: no-autoplace */ in your CSS. (alias for the deprecated true value)
  • stats (object): custom usage statistics for > 10% in my stats browsers query.
  • overrideBrowserslist (array): list of queries for target browsers. Try to not use it. The best practice is to use .browserslistrc config or browserslist key in package.json to share target browsers with Babel, ESLint and Stylelint. See Browserslist docs for available queries and default value.
  • ignoreUnknownVersions (boolean): do not raise error on unknown browser version in Browserslist config. Default is false.

Plugin object has info() method for debugging purpose.

You can use PostCSS processor to process several CSS files to increase performance.

Environment Variables

  • AUTOPREFIXER_GRID: (autoplace|no-autoplace) should Autoprefixer add IE 10-11 prefixes for Grid Layout properties?
    • autoplace: enable Autoprefixer grid translations and include autoplacement support.
    • no-autoplace: enable Autoprefixer grid translations but exclude autoplacement support.

Environment variables are useful, when you want to change Autoprefixer options but don't have access to config files. Create React App is a good example of this.

Using environment variables to support CSS Grid prefixes in Create React App

  1. Install the latest version of Autoprefixer and cross-env:
npm install autoprefixer@latest cross-env --save-dev
  1. Under "browserslist" > "development" in the package.json file, add "last 1 ie version"
"browserslist": {
  "production": [
    ">0.2%",
    "not dead",
    "not op_mini all"
  ],
  "development": [
    "last 1 chrome version",
    "last 1 firefox version",
    "last 1 safari version",
    "last 1 ie version"
  ]
}
  1. Update "scripts" in the package.json file to the following:
"scripts": {
  "start": "cross-env AUTOPREFIXER_GRID=autoplace react-scripts start",
  "build": "cross-env AUTOPREFIXER_GRID=autoplace react-scripts build",
  "test": "cross-env AUTOPREFIXER_GRID=autoplace react-scripts test",
  "eject": "react-scripts eject"
},

Replace autoplace with no-autoplace in the above example if you prefer to disable Autoprefixer Grid autoplacement support.

Now when you run npm start you will see CSS Grid prefixes automatically being applied to your output CSS.

See also Browserslist environment variables for more examples on how to use environment variables in your project.

Grid Autoplacement support in IE

If the grid option is set to "autoplace", limited autoplacement support is added to Autoprefixers grid translations. You can also use the /* autoprefixer grid: autoplace */ control comment or AUTOPREFIXER_GRID=autoplace npm build environment variable.

Autoprefixer will only autoplace grid cells if both grid-template-rows and grid-template-columns has been set. If grid-template or grid-template-areas has been set, Autoprefixer will use area based cell placement instead.

Autoprefixer supports autoplacement by using nth-child CSS selectors. It creates [number of columns] x [number of rows] nth-child selectors. For this reason Autoplacement is only supported within the explicit grid.

/* Input CSS */

/* autoprefixer grid: autoplace */

.autoplacement-example {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  grid-gap: 20px;
}
/* Output CSS */

/* autoprefixer grid: autoplace */

.autoplacement-example {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: 1fr 20px 1fr;
  grid-template-columns: 1fr 1fr;
  -ms-grid-rows: auto 20px auto;
  grid-template-rows: auto auto;
  grid-gap: 20px;
}

.autoplacement-example > *:nth-child(1) {
  -ms-grid-row: 1;
  -ms-grid-column: 1;
}

.autoplacement-example > *:nth-child(2) {
  -ms-grid-row: 1;
  -ms-grid-column: 3;
}

.autoplacement-example > *:nth-child(3) {
  -ms-grid-row: 3;
  -ms-grid-column: 1;
}

.autoplacement-example > *:nth-child(4) {
  -ms-grid-row: 3;
  -ms-grid-column: 3;
}

Beware of enabling autoplacement in old projects

Be careful about enabling autoplacement in any already established projects that have previously not used Autoprefixer's grid autoplacement feature before.

If this was your html:

<div class="grid">
  <div class="grid-cell"></div>
</div>

The following CSS will not work as expected with the autoplacement feature enabled:

/* Unsafe CSS when Autoplacement is enabled */

.grid-cell {
  grid-column: 2;
  grid-row: 2;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

Swapping the rules around will not fix the issue either:

/* Also unsafe to use this CSS */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.grid-cell {
  grid-column: 2;
  grid-row: 2;
}

One way to deal with this issue is to disable autoplacement in the grid-declaration rule:

/* Disable autoplacement to fix the issue */

.grid {
  /* autoprefixer grid: no-autoplace */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.grid-cell {
  grid-column: 2;
  grid-row: 2;
}

The absolute best way to integrate autoplacement into already existing projects though is to leave autoplacement turned off by default and then use a control comment to enable it when needed. This method is far less likely to cause something on the site to break.

/* Disable autoplacement by default in old projects */
/* autoprefixer grid: no-autoplace */

/* Old code will function the same way it always has */
.old-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}
.old-grid-cell {
  grid-column: 2;
  grid-row: 2;
}

/* Enable autoplacement when you want to use it in new code */
.new-autoplace-friendly-grid {
  /* autoprefixer grid: autoplace */
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
}

Note that the grid: "no-autoplace" setting and the /* autoprefixer grid: no-autoplace */ control comment share identical functionality to the grid: true setting and the /* autoprefixer grid: on */ control comment. There is no need to refactor old code to use no-autoplace in place of the old true and on statements.

Autoplacement limitations

Both columns and rows must be defined

Autoplacement only works inside the explicit grid. The columns and rows need to be defined so that Autoprefixer knows how many nth-child selectors to generate.

.not-allowed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.is-allowed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(10, auto);
}

Repeat auto-fit and auto-fill are not supported

The repeat(auto-fit, ...) and repeat(auto-fill, ...) grid functionality relies on knowledge from the browser about screen dimensions and the number of available grid items for it to work properly. Autoprefixer does not have access to this information so unfortunately this little snippet will never be IE friendly.

.grid {
  /* This will never be IE friendly */
  grid-template-columns: repeat(auto-fit, min-max(200px, 1fr))
}

No manual cell placement or column/row spans allowed inside an autoplacement grid

Elements must not be manually placed or given column/row spans inside an autoplacement grid. Only the most basic of autoplacement grids are supported. Grid cells can still be placed manually outside the the explicit grid though. Support for manually placing individual grid cells inside an explicit autoplacement grid is planned for a future release.

.autoplacement-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
}

/* Grid cells placed inside the explicit grid
   will break the layout in IE */
.not-permitted-grid-cell {
  grid-column: 1;
  grid-row: 1;
}

/* Grid cells placed outside the
   explicit grid will work in IE */
.permitted-grid-cell {
  grid-column: 1 / span 2;
  grid-row: 4;
}

If manual cell placement is required, we recommend using grid-template or grid-template-areas instead:

.page {
  display: grid;
  grid-gap: 30px;
  grid-template:
      "head head"
      "nav  main" minmax(100px, 1fr)
      "foot foot" /
      200px 1fr;
}
.page__head {
  grid-area: head;
}
.page__nav {
  grid-area: nav;
}
.page__main {
  grid-area: main;
}
.page__footer {
  grid-area: foot;
}

Do not create ::before and ::after pseudo elements

Let's say you have this HTML:

<div class="grid">
  <div class="grid-cell"></div>
</div>

And you write this CSS:

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
}

.grid::before {
  content: 'before';
}

.grid::after {
  content: 'after';
}

This will be the output:

.grid {
  display: -ms-grid;
  display: grid;
  -ms-grid-columns: 1fr 1fr;
  grid-template-columns: 1fr 1fr;
  -ms-grid-rows: auto;
  grid-template-rows: auto;
}

.grid > *:nth-child(1) {
  -ms-grid-row: 1;
  -ms-grid-column: 1;
}


.grid > *:nth-child(2) {
  -ms-grid-row: 1;
  -ms-grid-column: 2;
}

.grid::before {
  content: 'before';
}

.grid::after {
  content: 'after';
}

IE will place .grid-cell, ::before and ::after in row 1 column 1. Modern browsers on the other hand will place ::before in row 1 column 1, .grid-cell in row 1 column 2, and ::after in row 2 column 1.

See this CodePen to see a visualization of the issue. View the CodePen in both a modern browser and IE to see the difference.

Note that you can still create ::before and ::after elements as long as you manually place them outside the explicit grid.

When changing the grid gap value, columns and rows must be re-declared

If you wish to change the size of a grid-gap, you will need to redeclare the grid columns and rows.

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-gap: 50px;
}

/* This will *NOT* work in IE */
@media (max-width: 600px) {
  .grid {
    grid-gap: 20px;
  }
}

/* This will *NOT* work in IE */
.grid.small-gap {
  grid-gap: 20px;
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-gap: 50px;
}

/* This *WILL* work in IE */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    grid-gap: 20px;
  }
}

/* This *WILL* work in IE */
.grid.small-gap {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-gap: 20px;
}

Debug

Run npx autoprefixer --info in your project directory to check which browsers are selected and which properties will be prefixed:

$ npx autoprefixer --info
Browsers:
  Edge: 16

These browsers account for 0.26% of all users globally

At-Rules:
  @viewport: ms

Selectors:
  ::placeholder: ms

Properties:
  appearance: webkit
  flow-from: ms
  flow-into: ms
  hyphens: ms
  overscroll-behavior: ms
  region-fragment: ms
  scroll-snap-coordinate: ms
  scroll-snap-destination: ms
  scroll-snap-points-x: ms
  scroll-snap-points-y: ms
  scroll-snap-type: ms
  text-size-adjust: ms
  text-spacing: ms
  user-select: ms

JS API is also available:

console.log(autoprefixer().info())

Security Contact

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

For Enterprise

Available as part of the Tidelift Subscription.

The maintainers of autoprefixer and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

autoprefixer's People

Contributors

aaron3 avatar ai avatar ben-eb avatar bogdan0083 avatar coliff avatar cornbreadcompanion avatar cvle avatar cvn avatar dan503 avatar fanich37 avatar gucong3000 avatar heady avatar iamvdo avatar janczer avatar kieranju avatar kossnocorp avatar lukewarlow avatar lydell avatar moox avatar nschonni avatar porada avatar regularlabs avatar romainmenke avatar semigradsky avatar stevemao avatar sukkaw avatar taritsyn avatar trevorah avatar yepninja avatar yisibl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autoprefixer's Issues

Mechanism doesn't see the second image in multiple gradient

before:

BODY {
  background-image:
    linear-gradient(-45deg, transparent 0, transparent 25px, rgba(204, 54, 54, 0.8) 25px, rgba(204, 54, 54, 0.8) 35px, transparent 35px),
    linear-gradient(-45deg, transparent 0, transparent 25px, rgba(54, 104, 154, 0.8) 25px, rgba(54, 104, 154, 0.8) 35px, transparent 35px);
  background-position: 0 100%, 30px 100%;
  background-size: 60px 100%;
  background-repeat: repeat-x;
}

after:

BODY {
  background-image: -webkit-linear-gradient(-45deg, transparent 0, transparent 25px, rgba(204, 54, 54, 0.8) 25px, rgba(204, 54, 54, 0.8) 35px, transparent 35px),
    linear-gradient(-45deg, transparent 0, transparent 25px, rgba(54, 104, 154, 0.8) 25px, rgba(54, 104, 154, 0.8) 35px, transparent 35px);
  background-image: -o-linear-gradient(-45deg, transparent 0, transparent 25px, rgba(204, 54, 54, 0.8) 25px, rgba(204, 54, 54, 0.8) 35px, transparent 35px),
    linear-gradient(-45deg, transparent 0, transparent 25px, rgba(54, 104, 154, 0.8) 25px, rgba(54, 104, 154, 0.8) 35px, transparent 35px);
  background-image: linear-gradient(-45deg, transparent 0, transparent 25px, rgba(204, 54, 54, 0.8) 25px, rgba(204, 54, 54, 0.8) 35px, transparent 35px),
    linear-gradient(-45deg, transparent 0, transparent 25px, rgba(54, 104, 154, 0.8) 25px, rgba(54, 104, 154, 0.8) 35px, transparent 35px);
  background-position: 0 100%, 30px 100%;
  background-size: 60px 100%;
  background-repeat: repeat-x
}

Support for ::input-placeholder

From "Change an input's HTML5 placeholder color with CSS":

::-webkit-input-placeholder { /* WebKit browsers */
    color:    #999;
}
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    color:    #999;
}
::-moz-placeholder { /* Mozilla Firefox 19+ */
    color:    #999;
}
:-ms-input-placeholder { /* Internet Explorer 10+ */
    color:    #999;
}

I tried different variations (::input-placeholder, ::placeholder) but seems like it doesn't supports by autoprefixer.

Thanks.

Filter prefixer

I think this shouldn't happening.

-webkit-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fffcde', endColorstr='#00ffffff',GradientType=0 );
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fffcde', endColorstr='#00ffffff',GradientType=0 );

either your data or your filter is incorrect

using rework, i didn't set a filter and i get

{
  -webkit-transition: b-webkit-order linear 0.2s, box-shadow linear 0.2s;
  -moz-transition: b-moz-order linear 0.2s, box-shadow linear 0.2s;
  -ms-transition: b-ms-order linear 0.2s, box-shadow linear 0.2s;
  -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
  -o-transition: border linear 0.2s, box-shadow linear 0.2s;
  transition: border linear 0.2s, box-shadow linear 0.2s

  -moz-box-sizing: border-box;
  box-sizing: b-webkit-order-box;
  box-sizing: b-moz-order-box;
  box-sizing: b-ms-order-box;
  box-sizing: border-box
}

assuming it's last 2 versions by default (when i don't put anything), it's broken: http://caniuse.com/#feat=css-transitions. I should only be seeing -webkit for transitions. i should not see -ms for box-sizing: http://caniuse.com/#search=box-sizing

or maybe the ones that are like b-[vendor]- just shouldn't be there. i think that makes sense.

`-webkit-background-clip:` is removed and `background-clip` isn't prefixified

$ echo 'li { -webkit-background-clip: text; color: black; }' | autoprefixer -b 'chrome 28'
li {
  color: black;
}

$ echo 'li { background-clip: text; color: black; }' | autoprefixer -b 'chrome 28'
li {
  background-clip: text;
  color: black;
}

The problem here is Chrome 28 still requires the -webkit- prefix.

In fact, I can’t seem to get the -webkit prefix no matter what version of Chrome I specify. The only way I could get the prefix is to run it: autoprefix -b '> 1%':

echo 'li { background-clip: text; color: black; }' | autoprefixer -b "> 1%"
li {
  -webkit-background-clip: text;
  background-clip: text;
  color: black;
}

display: flex is not supported.

If I specify display: flex, the expected result, given I specify old browsers, should be something like:

display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;

The actual result is:

display: flex;

Prevent duplication and remove unneeded prefixes

The user might already have some of the properties prefixed while others not. Currently if you run autoprefixer on already prefixed properties it will duplicate them.

Before:

body {
  -webkit-transition: all 1s ease-out;
  -o-transition: all 1s ease-out;
  transition: all 1s ease-out
}

After:

body {
  -webkit-transition: all 1s ease-out;
  -o-transition: all 1s ease-out;
  -webkit-transition: all 1s ease-out;
  -o-transition: all 1s ease-out;
  transition: all 1s ease-out
}

It should also remove no longer needed properties that might already exist in the CSS file.

Incorrect prefixes of values

(v. 0.3.20130423)

Command:

$ autoprefixer test.css -b "ff 15, opera 12, chrome 25"

Output (there is always the the only one prefix):

background: -webkit-linear-gradient(#000, #111); /* -moz for FF 15 and -o for Opera 12? */
background: linear-gradient(#000, #111);
width: -webkit-calc(1px + 1px); /* -moz for FF 15? */
width: calc(1px + 1px)

[autoprefixer-rails] Conflict with `turbo-sprockets-rails3`

So, I have such part in my Gemfile (exact copy):

group :assets do
  gem 'oily_png'

  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.2'
  gem 'uglifier',     '~> 1.3.0'

  gem 'compass-rails'
  gem 'handlebars_assets', '= 0.8.2'

  gem 'sass-mediaqueries-rails'
  gem 'autoprefixer-rails'

  gem 'turbo-sprockets-rails3'
end

In development everything works like a charm, but if I try to run rake assets:precompile (or deploy an app with Capistrano) i get:

% rake assets:precompile
/usr/local/opt/rbenv/versions/2.0.0-p195/bin/ruby /usr/local/opt/rbenv/versions/2.0.0-p195/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
TypeError: Cannot call method 'map' of undefined
  (in /Users/kavu/Work/my_app/app/assets/stylesheets/application.scss) 

My application.scss is a bunch of SCSS @imports.

Commenting out gem 'turbo-sprockets-rails3' solves the problem.

Property 'undefined' of object #<Compiler> is not a function

In Rails gem with 0.4.20130524 version:

ExecJS::ProgramError - TypeError: Property 'undefined' of object #<Compiler> is not a function=0A

Maybe part of new unreleased (in npm) fixes for Rework? In my case, I can't reproduce issue. Will be good, if somebody help my with CSS, that call this error.

Watch

It will be useful to have autoprefixer --watch parameter to launch one time and get prefixes after every compilation.
As a workaround I suggest LiveReload, it can launch custom command line string after every compilation.

Do autoprefixer support gradient?

I have a style like this:

#header{
    position: absolute;
    z-index: 9999;
    height: 40px;
    width: 100%;
    top: -40px;
    overflow: hidden;
    transform: translate(0px, 40px);
    background: gradient(linear,0 0,0 100%,from(#E6E6E6),to(#D1D5D6));
    box-shadow: 0 2px 1px 0 #A3A5A8;
}

but after autoprefixer, css like this:

#header {
  position: absolute;
  z-index: 9999;
  height: 40px;
  width: 100%;
  top: -40px;
  overflow: hidden;
  -webkit-transform: translate(0px, 40px);
  -ms-transform: translate(0px, 40px);
  -o-transform: translate(0px, 40px);
  transform: translate(0px, 40px);
  background: gradient(linear,0 0,0 100%,from(#E6E6E6),to(#D1D5D6));
  box-shadow: 0 2px 1px 0 #A3A5A8;
}

so the background: gradient(linear,0 0,0 100%,from(#E6E6E6),to(#D1D5D6));
is invalid in chrome, I've expected a vendor prefix -webkit would be added, but didn't.

Do the tool support gradient? Or Do I set error?

Best Regards

Preserve indentation

A tab or 4 space indentation is converted to 2 spaces:

body {
    transition: all 1s ease-out;
}
body {
  -webkit-transition: all 1s ease-out;
  -o-transition: all 1s ease-out;
  transition: all 1s ease-out
}

This is important as people don't like tools mucking with their precious indentation.

Support for ::selection

::selection {
    transition: color 0.1s ease-out;
    color: blue;
}

⬇️

::-moz-selection {
    -webkit-transition: color 0.1s ease-out;
    transition: color 0.1s ease-out;
    color: blue;
}

::selection {
    -webkit-transition: color 0.1s ease-out;
    transition: color 0.1s ease-out;
    color: blue;
}

According to MDN, Firefox doesn’t support unprefixed ::selection selector. Other browsers either support the unprefixed version or don’t support the selector at all, so it’s safe to assume that only the -moz- prefix will be needed in the near future.

Unfortunately, this is not covered in Can I Use data (yet).

I was planning to make a pull request for it, but the current architecture doesn’t seem to allow for inserting new selectors easily.

(-moz-)document parsing is broken

The following CSS breaks:

@-moz-document url-prefix(){
    .ui-select .ui-btn select{
        opacity:.0001
    }
}

This showed up as part of some jQuery CSS.

This also breaks:

@document url-prefix(){
    .ui-select .ui-btn select{
        opacity:.0001
    }
}

Output in both cases when reading in a file with the above content:

TypeError: 'undefined' is not an object (evaluating 'node.declarations.map')
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:19:in `eval'
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:33:in `call'
/Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/autoprefixer-rails-0.4.20130515/lib/autoprefixer-rails.rb:27:in `compile'

Comments for IE-hack-ish CSS breaks prefixer

Some CSS, mainly legacy stuff, relies on CSS hacks that happen to work. For example, this is for targetting IE5 (or something):

display/**/: block;

Unfortunately it seems AutoprefixerRails.compile can't handle it.

1.9.3p194 :006 > AutoprefixerRails.compile("foo { bar/*broken*/: baz }")
ExecJS::ProgramError: TypeError: Cannot call method 'map' of undefined
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:49:in `rescue in block in call'
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:43:in `block in call'
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:80:in `block in lock'
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.10.2/lib/v8/c/locker.rb:13:in `Locker'
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:78:in `lock'
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/execjs-1.4.0/lib/execjs/ruby_racer_runtime.rb:42:in `call'
    from /Users/adam/.rvm/gems/ruby-1.9.3-p194/gems/autoprefixer-rails-0.4.20130515/lib/autoprefixer-rails.rb:27:in `compile'
    from (irb):6
    from /Users/adam/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

Error: Cannot find module './lib/rework'

I am running Ubuntu 13.04 and I have installed autoprefixer via sudo npm install --global autoprefixer.

Getting this error:

module.js:337
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module './lib/rework'
at Function._resolveFilename (module.js:337:11)
at Function._load (module.js:279:25)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object. (/usr/local/lib/node_modules/autoprefixer/node_modules/rework/index.js:2:18)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:32)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)

How should I do to use autoprefixer

Hello:
Some class like this in my project:

.css3vertical {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-box-pack: center;
    -webkit-box-align: center;
}

but the result hasn't any difference to original code.
if my code is like this:

.css3vertical {
    display:box;
    box-orient: vertical;
    box-pack: center;
    box-align: center;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-box-pack: center;
    -webkit-box-align: center;
}

this result is:

.css3vertical {
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: box;
  -webkit-box-direction: normal;
  -webkit-flex-direction: vertical;
  -moz-box-orient: vertical;
  -moz-box-direction: normal;
  -ms-flex-direction: vertical;
  box-orient: vertical;
  -webkit-justify-content: center;
  -moz-box-pack: center;
  -ms-flex-pack: center;
  box-pack: center;
  -webkit-align-items: center;
  -moz-box-align: center;
  -ms-flex-align: center;
  box-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-box-pack: center;
  -webkit-box-align: center;
}

It's what I want. Must I write like this? Can't autoprefixer handle the first condition?

Prefixed properties and values

I know it is a complicated case, but if I have this code:

perspective: calc(50em + 15px);

I would like to have something like this:

-webkit-perspective: -webkit-calc(50em + 15px);
-moz-perspective: -moz-calc(50em + 15px);
-moz-perspective: calc(50em + 15px);
perspective: -webkit-calc(50em + 15px);
perspective: calc(50em + 15px);

But instead result is:

perspective: calc(50em + 15px); /* This line shouldn't be first */
-webkit-perspective: -webkit-calc(50em + 15px);
-ms-perspective: -webkit-calc(50em + 15px); /* -ms vs. -webkit and `perspective` is supported unprefixed in IE 10 and later */
-o-perspective: -webkit-calc(50em + 15px); /* -o vs. -webkit  */
perspective: -webkit-calc(50em + 15px)

The aforementioned code shows a general case when we use prefixed properties and values, for another instance:

transform: rotate(calc(1deg + 1deg));
-webkit-transform: rotate(-webkit-calc(1deg + 1deg));
-ms-transform: rotate(-webkit-calc(1deg + 1deg));
-o-transform: rotate(-webkit-calc(1deg + 1deg));
transform: rotate(-webkit-calc(1deg + 1deg))

So we have at least two possible improvements: (1) put the first line (without prefixes) onto the end and (2) get rid of rules with different vendor prefixes in properties and values. But what is more difficult, there is also complicated combinations between prefixed properties and values in specific cases.

Anyway, thanks for the great tool!

Include additional browser choices in updater coffeescript file

Currently the update script updaters/lib/updater.coffee generates data for Firefox, Chrome, Safari, iOS, Opera, and IE. For mobile development work, it would help to also have supported android and bb identifiers added to the browsers: object.

  # Can I Use browser names to internal
  browsers:
    firefox: 'ff'
    chrome:  'chrome'
    safari:  'safari'
    ios_saf: 'ios'
    opera:   'opera'
    ie:      'ie'
    android: 'android'
    bb:      'bb'

b-vendor-order

* {
  -moz-box-sizing: border-box;
  box-sizing: b-webkit-order-box;
  box-sizing: b-moz-order-box;
  box-sizing: b-ms-order-box;
  box-sizing: border-box
}

{
  -webkit-transition: b-webkit-order linear 0.2s, box-shadow linear 0.2s;
  -moz-transition: b-moz-order linear 0.2s, box-shadow linear 0.2s;
  -ms-transition: b-ms-order linear 0.2s, box-shadow linear 0.2s;
  -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
  -o-transition: border linear 0.2s, box-shadow linear 0.2s;
  transition: border linear 0.2s, box-shadow linear 0.2s
}

what's going on!? your parser doesn't like border or something

Wrong box-sizing prefixing

The box-sizing property...

box-sizing: border-box;

...with default autoprefixer settings converts to:

-moz-box-sizing: border-box;
box-sizing: b-webkit-order-box;
box-sizing: b-moz-order-box;
box-sizing: b-ms-order-box;
box-sizing: border-box

What about a new syntax for gradients?

It would be nice to have a fallback for old syntax when we use the new one (with to keyword). I mean if I type this:

.test {
  background-image: linear-gradient(to right bottom, #000, #fff);
}

I would like to see this output:

.test {
  background-image: -webkit-linear-gradient(top left, #000, #fff); /* and other prefixes... */
  background-image: linear-gradient(top left, #000, #fff); /* fallback to old syntax */
  background-image: linear-gradient(to right bottom, #000, #fff);
}

Source maps

After Autoprefixer's work source maps became broken because it line number is changed.
I suggest a function that will fix source maps (.map files and Sass' custom media-rules).
As a workaround I suggest insertion JS into page that will add prefixes on-the-fly (like -prefix-free.js but with caniuse support) and add prefixes to the original CSS only before publishing to production.

Add a way to add basic support for stuff that don't yet exist at caniuse

You should add support for #44 and similar stuff, like hyphens, tab-size etc, before they appear at CanIuse.

It is better to have those properties always prefixed, than to wait it to be added properly. And when it would be at canIuse, you would update you data with it, and noone would be hurt.

But right now I need either to use my own mixins in preprocessors, or to write all the stuff manually, while it would be much better to have working solution from autoprefixer now and optimized one later.

Support "appearance"?

I see that appearance is not supported equally through different browsers, but maybe at least some

appearance: none
-webkit-appearance: none
-moz-appearance: none

support would be nice?

Support for border-image (and sub-properties)

http://caniuse.com/#search=border-image etc.

However, there should be at least one hack for it: when you add a fill value for unprefixed border-images, you should remove it from all the prefixed ones, so

border-image: url('frame.png') 20% fill stretch stretch;

should become

-webkit-border-image: url('frame.png') 20% stretch stretch;
   -moz-border-image: url('frame.png') 20% stretch stretch;
     -o-border-image: url('frame.png') 20% stretch stretch;
        border-image: url('frame.png') 20% fill stretch stretch;  

(and don't forget to support gradients inside of border-images)

cli throws on --browser argument

This

autoprefixer test.css -b '2 last versions,ie8'

will make autoprefixer throw:

/Users/sindresorhus/Projects/autoprefixer/lib/autoprefixer.js:155
            throw new Error('Unknown browser `' + name + '`');
                  ^
Error: Unknown browser `2`
    at Object.autoprefixer.check (/Users/sindresorhus/Projects/autoprefixer/lib/autoprefixer.js:155:19)
    at /Users/sindresorhus/Projects/autoprefixer/lib/autoprefixer.js:123:36
    at Array.map (native)
    at Object.autoprefixer.parse (/Users/sindresorhus/Projects/autoprefixer/lib/autoprefixer.js:108:22)
    at Object.autoprefixer.filter (/Users/sindresorhus/Projects/autoprefixer/lib/autoprefixer.js:80:29)
    at Object.autoprefixer.compile (/Users/sindresorhus/Projects/autoprefixer/lib/autoprefixer.js:68:45)
    at Object.<anonymous> (/Users/sindresorhus/Projects/autoprefixer/bin/autoprefixer:126:33)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

test.css

body {
  transition: all 1s ease-out
}

Proposed improvements for flex fallbacks

After reading different articles on the topic, I've begun to summarize the ways to fallback the flex spec.

screen shot 2013-05-16 at 10 47 17 pm

I will make a PR that implements as much as I can.

Of particular difficulty is flex-grow flex-shrink and flex-basis. To have these fallback we need to assign the flex shorthand for -ms- but that seems dubious since we cannot assume the three individual properties are all coming from one selector. It also appears impossible to support shrink and basis in the 2009 spec. In short it doesn't seem like there is a way to provide fallback for the grow/shrink/basis properties.

Latest autoprefixer (0.6.20130721) fails with an exception

Running "autoprefixer:dist" (autoprefixer) task
Warning: Cannot call method 'slice' of undefined Use --force to continue.
TypeError: Cannot call method 'slice' of undefined
    at utils.clone.keyframes (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/keyframes.js:18:30)
    at Array.map (native)
    at Keyframes.clone (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/keyframes.js:16:40)
    at Keyframes.cloneWithPrefix (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/keyframes.js:29:20)
    at /Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/processor.js:16:28
    at Prefixes.each (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/prefixes.js:135:25)
    at /Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/processor.js:15:31
    at CSS.eachKeyframes (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/css.js:21:11)
    at Processor.add (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer/processor.js:11:11)
    at Autoprefixer.rework (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer.js:59:31)
    at Autoprefixer.rework (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer.js:4:61)
    at Autoprefixer.compile (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/node_modules/autoprefixer/lib/autoprefixer.js:52:12)
    at /Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/tasks/autoprefixer.js:42:47
    at Array.forEach (native)
    at Object.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt-autoprefixer/tasks/autoprefixer.js:21:20)
    at Object.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/grunt/task.js:258:15)
    at Object.thisTask.fn (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/grunt/task.js:78:16)
    at Object.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:282:30)
    at Task.runTaskFn (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:235:24)
    at Task.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:281:12)
    at Task.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:215:7)
    at Task.runTaskFn (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:238:9)
    at Task.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:281:12)
    at Task.<anonymous> (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:215:7)
    at null._onTimeout (/Users/leonidkhachaturov/code/hdt/webui/playground/node_modules/grunt/lib/util/task.js:225:33)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

opacity prefixes

I'm no expert at old IEs, but I noticed that the filter property was missing when selecting IE6+. I think, ideally,

opacity: 0.5;

should turn into:

zoom: 1;                          /* IE 5, 6, 7 need this fix, probably best to only apply if the selector doesn't have zoom already*/ 
filter: alpha(opacity=50);        /* IE 6, 7, 8 */ 
-khtml-opacity: 0.5;              /* Safari 1.x (pre WebKit!) */
opacity: 0.5                      /* IE9+ and all other browsers */

Excluding browser prefixes

This is more of a question/feature request.

Is there a way to exclude browsers (and their prefixes)?

Say, to prefix considering the latest two versions of browsers, but leave out Opera prefixes completely.

autoprefixer.compile(css, ['last 2 version', '!opera']);

Awesome tool by the way. Thank you.

Prefixed order in b[order]-box

For example it replaces box-sizing: border-box with box-sizing: b-moz-order-box because of 'order' rule. Actually this may be an rework issue, not sure.

Error

Autoprefixer error: ... "node" ...


Update: I opted fpr prefixfree.js

Custom values of prefixed props

I need, for some reasons, following css code:

.class {
    transition: all .1s;
    -o-transition: all .2s;
}

And I want to generate (with autoprefixer help) something like

.class {
    -webkit-transition: all .1s;
    transition: all .1s;
    -o-transition: all .2s;
}

but I got

.class {
    -o-transition: all .2s;
    -o-transition: all .1s;
    -webkit-transition: all .1s;
    transition: all .1s;
}

Is it possible to configure autoprefixer in such a way? i.e. I want the possibility to overwrite prefixed props by myself and place it after unprefixed prop.

-moz-linear-gradient

autoprefixer.compile('body { background: linear-gradient(top, #809e2e 0%, #bbce62 42%, #8aa73b 62%, #638e09 100%); }')

compiles to:

body {
  background: -webkit-linear-gradient(top, #809e2e 0%, #bbce62 42%, #8aa73b 62%, #638e09 100%)
  background: linear-gradient(top, #809e2e 0%, #bbce62 42%, #8aa73b 62%, #638e09 100%);
}

It could just be my lack of understanding of how linear-gradient works, but I was expecting -moz-linear-gradient in there too? i.e. this looks fine in Firefox:

moz-linear-gradient(center top , #FFFFFF 0%, #DBDEDE 15%, #545D5C 35%, #636C6A 50%, #E7ECE8 70%, #E9EAE9 87%, #AEAEB2 100%) repeat scroll 0 0 transparent

using node/npm verison.

Standalone JS usage

Can I use Autoprefixer standalone version to use it on developing? Like -prefix-free.js by @LeaVerou.
I tried, but cannot understand what to do with it.
I just downloaded JS and connect it to HTML, then added this lines to main.js:

var css = 'stylesheets/main.css';
var prefixed = autoprefixer.compile(css);

But got Error: Can't parse CSS on line 1393 of autoprefixer.js.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.