我正在 gulp 中运行一个非常简单的预处理任务,但它没有按预期工作。
这是任务:
import preprocess from 'gulp-preprocess'
function testpp() {
return gulp.src('./test')
.pipe(preprocess())
.pipe(gulp.dest('./tmp'))
}
输入文件
something
// @ifdef SOMEVAR
should be gone
// @endif
出来不变。我预计这部分“应该消失”会被移除。
gulp-preprocess文档有这个例子:
// @ifdef DEBUG
someDebuggingCall();
// @endif
任何想法我做错了什么?
$ npm -v
6.10.1
$ gulp -v
CLI version: 2.2.0
Local version: 4.0.2
$ node -v
v10.16.0
从package.json
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babel-core": "^6.26.3",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"eslint": "^6.1.0",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0-beta.2",
"gulp-cli": "^2.2.0",
"gulp-preprocess": "^3.0.2",
"through2": "^3.0.1",
"transfob": "^1.0.0"
}