运行默认任务(sequence of 3 tasks sass then RTL then minify )
时,gulp会抛出异常,并抛出此错误Unknown word
我将gulp 3与gulp-sass,gulp-RTL,gulp-uglify一起使用 运行默认任务时,出现异常并尝试了很多事情,但没有结果
//这里例外
de_modules\postcss\lib\lazy-result.js:248
if (this.error) throw this.error;
^
CssSyntaxError: <css input>:4363:3: Unknown word
at Input.error (..\node_modules\postcss\lib\input.js:119:22)
at Parser.unknownWord (..\node_modules\postcss\lib\parser.js:506:26)
at Parser.other (..\node_modules\postcss\lib\parser.js:171:18)
at Parser.parse (..\node_modules\postcss\lib\parser.js:84:26)
at parse (..\node_modules\postcss\lib\parse.js:24:16)
at new LazyResult (..\node_modules\postcss\lib\lazy-result.js:70:24)
at Processor.process (..\node_modules\postcss\lib\processor.js:117:12)
at DestroyableTransform._transform (..\node_modules\gulp-rtlcss\index.js:26:47)
at DestroyableTransform.Transform._read (..\node_modules\readable-stream\lib\_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (..\node_modules\readable-stream\lib\_stream_transform.js:172:83)
//exception ends here
// sass compile
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCss = require("gulp-minify-css");
var uglify = require("gulp-uglify");
var rtlcss = require("gulp-rtlcss");
var runSeq = require('run-sequence');
var gulpIf = require('gulp-if');
gulp.task('sass_plugins', function () {
var tasks = [];
tasks.push(sass_plugins());
return tasks;
});
gulp.task('minify_plugins', function () {
// minify
var tasks = [];
tasks.push(minify_plugins());
return tasks;
});
gulp.task('rtl_plugins', function () {
var tasks = [];
tasks.push(rtl_plugins());
return tasks;
});
var sass_plugins = function () {
var tasks = [];
// bootstrap compilation
tasks.push(
gulp
.src('./assets/src/sass/bootstrap.scss')
.pipe(sass())
.pipe(gulp.dest('./assets/dist/global/plugins/bootstrap/css'))
);
// select2 compilation using bootstrap variables
tasks.push(gulp
.src('./assets/plugins/select2/sass/select2-bootstrap.min.scss')
.pipe(sass({ outputStyle: 'compressed' }))
.pipe(gulp.dest('./assets/dist/global/plugins/select2/css'))
);
return tasks;
};
var minify_plugins = function () {
// css minify plugins
var tasks = [];
tasks.push(gulp
.src(['./assets/dist/global/plugins/bootstrap/css/*.css', '!./assets/dist/global/plugins/bootstrap/css/*.min.css'])
.pipe(minifyCss())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./assets/dist/global/plugins/bootstrap/css')));
tasks.push(gulp
.src(['./assets/dist/global/plugins/select2/css/*.css', '!./assets/dist/global/plugins/select2/css/*.min.css'])
.pipe(minifyCss())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./assets/dist/global/plugins/select2/css')));
return tasks;
};
gulp.task('default', function (cb) {
runSeq('sass_plugins', 'rtl_plugins', 'minify_plugins', cb);
});
我想让默认任务运行这3个任务,请帮助 当分别运行每个任务时,它运行良好