php.json
{
"data" : "<?php echo $data; ?>"
}
家玉
script.
var data = !{data};
模板.js
gulp.task('templates-in-one-folder', () => {
let data = dddata('ru');
return gulp.src('app/**/*.jade')
.pipe(plumber({errorHandler: errorHandler('Error in \'templates\' task')}))
.pipe(cached('jade'))
.pipe(gulpif(global.watch, inheritance({basedir: 'app'})))
.pipe(filter(file => /app[\\\/]pages/.test(file.path)))
.pipe(jade({basedir: 'app', data}))
.pipe(prettify({
braceStyle: 'expand',
indentWithTabs: true,
indentInnerHtml: true,
preserveNewlines: true,
endWithNewline: true,
wrapLineLength: 120,
maxPreserveNewlines: 50,
wrapAttributesIndentSize: 1,
unformatted: ['use']
}))
.pipe(staticHash({asset: 'dist', exts: ['js', 'css']}))
.pipe(rename({dirname: '.'}))
.pipe(gulp.dest('dist'))
});
我的输出
</div>
<script>
var data = < ? php echo $data; ? > ;
</script>
</body>
'<' '?' 之间 插入空格并且php代码无法正常工作。我该如何解决?我尝试使用带有正则表达式的'ignoreCustomFragments'的htmlmin,但它也不起作用......