postCss

终端

1、npm init (创建package.json

2、npm install autoprefixer postcss-color-rgba-fallback postcss-opacity postcss-pseudoelements postcss-vmin pixrem postcss-will-change--save-dev

3、gulpfile.js添加

var gulp = require('gulp');

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

var autoprefixer = require('autoprefixer');

var color_rgba_fallback = require('postcss-color-rgba-fallback');

var opacity = require('postcss-opacity');

var pseudoelements = require('postcss-pseudoelements');

var vmin = require('postcss-vmin');

var pixrem = require('pixrem');

var will_change = require('postcss-will-change');

gulp.task('css', function () {

    var processors = [

        will_change,

        autoprefixer,

        color_rgba_fallback,

        opacity,

        pseudoelements,

        vmin,

        pixrem

    ];

    return gulp.src('./src/*.css')

        .pipe(postcss(processors))

        .pipe(gulp.dest('./dest'));

});

你可能感兴趣的:(postCss)