我正在使用grunt将一些jade文件编译成html文件。
我的文件如下所示:
index.jade
|--partials/
view1.jade
view2.jade
我使用grunt-contrib-jade
通过以下代码编译它们:
jade: {
compile: {
options: {
data: {
debug: true
}
},
files:
[{
expand: true,
cwd: 'src/',
src: ['*.jade', '*/*.jade'],
dest: 'dist/views',
ext: '.html',
}]
}
},
它工作正常,所有文件都已编译,但是它破坏了文件结构,将所有文件放入 dist/views
有没有办法保持结构,即得到这样的东西?
dist/views
|--------- index.html
|---------/partials/
/ all other files
非常感谢
最佳答案
使用展平
属性:
files:
[{
expand: true,
flatten: false, // <---- don't flatten the folder structure
cwd: 'src/',
src: ['**/*.jade'], // <---- also update your glob to grab all the .jade files at once
dest: 'dist/views',
ext: '.html',
}]
关于javascript - 使用 grunt 编译时保持文件夹结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26474502/