使用grunt编译时保持文件夹的结构
Keep folders structure while compiling with grunt
我正在使用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
非常感谢
使用flatten
属性:
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',
}]
相关文章:
- 使用angularjs和node.js时的Web应用程序文件夹结构
- Dropzone.js-上传文件夹结构和单个文件
- 更改文件夹结构时未运行排行榜示例
- Meteor收集文件夹结构
- 如何在node.js中组织文件夹结构
- 更改sails.js中的配置文件夹结构
- 使用 webpack 在输出目录中保留文件夹结构
- 如何在文件夹结构中获取.json文件
- Javascript:列出文件和文件夹结构
- 道场树中新文件夹结构中的问题
- Extjs MVC 文件夹结构无法加载文件
- 根据路径字符串构建嵌套文件夹结构
- 从视图源下载html的简单方法,同时保留文件夹结构
- 在将haml文件转换为html时复制整个文件夹结构(使用grunt)
- React JS和Meteor JS文件夹结构
- 从具有指定文件夹名称的文件夹结构中获取文件名
- 网页浏览动态文件夹结构
- AngularJS + Gulp文件和文件夹结构和正确的gulfull .js配置
- 组织Javascript库的最佳实践CSS文件夹结构
- Jquery文件夹结构