【发布时间】:2016-12-23 08:29:12
【问题描述】:
我想使用 gulp 将我的 pug 文件预处理为 html 文件。目前我的“默认”脚本中有这个:
gulp.watch([
'app/partials/**.pug',
'app/index.pug'], ['views-compile']
);
我的'views-compile'函数如下
var pug = require('gulp-pug2');
gulp.task('views-compile', function(){
return gulp.src([
'app/partials/**.pug',
'app/index.pug'
])
.pipe(pug.compile())
.pipe(gulp.dest('app/views/'))
})
当我运行此任务时,我收到文件已存在的错误
C:\dev\my-project>gulp views-compile
[09:18:01] Using gulpfile C:\dev\my-project\gulpfile.js
[09:18:01] Starting 'views-compile'...
[09:18:01] 'views-compile' errored after 190 ms
[09:18:01] Error: EEXIST: file already exists, mkdir 'C:\dev\my-project\app\views'
at Error (native)
我可以做些什么来解决这个问题并使用 *.pug 手表处理我的所有 pug 文件?
【问题讨论】:
-
检查
app/views不是现有文件的名称。除此之外,如果您希望有人能够帮助您,您必须提供一个重现问题的minimal reproducible example。