Created
November 8, 2016 08:59
-
-
Save mcattx/5c13c1813930ed62404c4a6145a2f50e to your computer and use it in GitHub Desktop.
Using postcss and autoprefixer in Gulp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'), | |
| // html | |
| // css | |
| postcss = require('gulp-postcss'), | |
| sourcemaps = require('gulp-sourcemaps'), | |
| precss = require('precss'), | |
| autoprefixer = require('autoprefixer'), | |
| cssnext = require('postcss-cssnext'), | |
| // js | |
| // debug | |
| debug = require('gulp-debug'); | |
| gulp.task('css', function() { | |
| // 定义 Postcsss 任务流数组 | |
| var processors = [ | |
| autoprefixer({ | |
| browsers: ['> 0.1%', 'Android >= 4.0'] | |
| }), | |
| precss(), | |
| cssnext() | |
| ]; | |
| return gulp.src('./src/**/*.css') | |
| .pipe(debug({title: 'check the file: '})) | |
| .pipe(postcss(processors)) | |
| .pipe(gulp.dest('./dist')) | |
| }) | |
| gulp.task('dev', ['css']); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment