Есть предельно упрощенный gulpfile.js
'use strict';
var gulp = require('gulp'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
csscomb = require('gulp-csscomb'),
minifyCss = require('gulp-minify-css'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer');
gulp.task('sass', function () {
gulp.src('src/sass/style.scss')
.pipe(sass())
.pipe(sass().on('error', sass.logError))
//.pipe(postcss([autoprefixer({browsers: ['last 3 versions']})]))
.pipe(csscomb())
.pipe(gulp.dest('build/css'))
.pipe(minifyCss({compatibility: 'ie8'}))
.pipe(rename('style.min.css'))
.pipe(gulp.dest('build/css/'))
;
});
В этом виде он отлично компилирует SASS в CSS. Но стоит раскомментировать строку с POSTSCC и тут же ошибка:
>gulp sass
[18:50:09] Using gulpfile C:\_git\Treehouse\gulpfile.js
[18:50:09] Starting 'sass'...
[18:50:09] Finished 'sass' after 8.7 ms
C:\_git\Treehouse\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:157
this.processing = new Promise(function (resolve, reject) {
^
ReferenceError: Promise is not defined
at LazyResult.async (C:\_git\Treehouse\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:157:31)
at LazyResult.then (C:\_git\Treehouse\node_modules\gulp-postcss\node_modules\postcss\lib\lazy-result.js:79:21)
at Transform.stream._transform (C:\_git\Treehouse\node_modules\gulp-postcss\index.js:49:8)
at Transform._read (_stream_transform.js:179:10)
at Transform._write (_stream_transform.js:167:12)
at doWrite (_stream_writable.js:226:10)
at writeOrBuffer (_stream_writable.js:216:5)
at Transform.Writable.write (_stream_writable.js:183:11)
at DestroyableTransform.ondata (C:\_git\Treehouse\node_modules\gulp-sass\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:531:20)
at DestroyableTransform.EventEmitter.emit (events.js:95:17)
И
postcss и
autoprefixer я переустанавливал - не помогло.
В чем проблема и как ее побороть??