0

I just copied the sample at https://www.npmjs.com/package/gulp-autoprefixer after I installed gulp and gulp-autoprefixer:

var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');

gulp.task('default', function () {
    return gulp.src('src/a.css')
        .pipe(autoprefixer({
            browsers: ['last 2 versions'],
            cascade: false
        }))
        .pipe(gulp.dest('dest'));
});

and I have following in my a.css:

@keyframes x {
    from { left: 0; }
    to { left: 100%; }
}

after I gulp, I get a.css in desc, but with the exact same code as the original. No -webkit- is added, but from http://caniuse.com/#search=keyframes it should be prefixed for Android Browser, which is my target device.

Am I missing something?

Jack Lu
  • 139
  • 2
  • 12

1 Answers1

1

The caniuse site specifies that keyframes are supported back to 4.3 without the need to prefix.

In gulp you have specified that prefixing should occur for the last 2 versions of browsers. Meaning prefixing will be based on rules set out by browsers from two versions previous:

browsers: ['last 2 versions']

If you want to support Android from a much earlier version then play around with the browsers option in the autoprefixer module:

browsers: ['last 5 versions']
Lowkase
  • 5,631
  • 2
  • 30
  • 48
  • From the caniuse page, in the Android Browser column, from 4.3-4.4.4, it has a '-' icon on it, saying "supported with prefix -webkit-", did you see it? – Jack Lu Jul 04 '16 at 16:28
  • Oh, before your answer I've already tried 'last 6 version' and fiddling around with other options, but it just doesn't work. Seeing your answer I go back to try it again, just to prove you're wrong, but this time it works! Wondering how I didn't get it in that 2 hours. Thank you. – Jack Lu Jul 04 '16 at 16:45
  • And as I've tried, 'last 3 version' is enough, which meets the data in caniuse page. The page specifies that android 5 and 6 don't need prefix. – Jack Lu Jul 04 '16 at 16:50
  • Feel free to make the answer as accepted if this was the final solution. – Lowkase Jul 04 '16 at 17:55