1:建立一個項目文件夾:css
2:在這個文件夾的路徑下cmd,npm
運行以下命令gulp
cnpm install gulp -gpost
cnpm install gulp --save-devui
cnpm install postcss autoprefixer cssnext precss --save-devspa
cnpm install --save-dev gulp-postcss
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var cssnext = require('cssnext');
var precss = require('precss');3d
gulp.task('css', function () {
var processors = [autoprefixer, cssnext, precss];
return gulp.src('./src/*.css').pipe(postcss(processors)).pipe(gulp.dest('./dest'));
});code
gulp.task('watch', function () {
gulp.watch('./src/*.css', ['css']);
});
gulp.task('default', ['watch', 'css']);blog