我无法弄清楚如何使用gulp配置pug-php-filter(https://www.npmjs.com/package/pug-php-filter)以便我可以在pug文件中使用php。
Plz帮助我。
答案 0 :(得分:2)
var rename = require('gulp-rename');
var pug = require('gulp-pug'),
pugPHPFilter = require('pug-php-filter');
gulp.task('pug', function() {
return gulp.src('./_pugfiles/**/*.pug')
.pipe( pug({
pretty: "\t",
filters: {
php: pugPHPFilter
}
}) )
.pipe(rename(function (path) {
path.extname = ".php"
}))
.pipe(gulp.dest('./site'));
});