pug - 编译的 .jade 文件的 Gruntfile 设置

标签 pug gruntjs

在我的 Gruntfile 中我有

jade: {
  html: {
    expand: true,
    src: ['public/views/**/*.jade'],
    dest: '.tmp',
    ext: '.html'
  }
},

它确实将 .jade 文件编译为 html,但包含 public/目录,从而生成 .tmp/public/views/foo.html,但我想要 .tmp/views/foo.html。

我为 Express 添加了一个额外的静态路径,它允许返回 public/*/.html,但最好保持干净。

有什么想法吗?

最佳答案

试试这个:

jade: {
    html: {
        files: [{
            expand: true,
            cwd: 'public/',
            src: ['views/**/*.jade'],
            dest: '.tmp',
            ext: '.html'
        }]
    }
}

关于pug - 编译的 .jade 文件的 Gruntfile 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17332550/

相关文章:

node.js - 在包含node.js的jade中使用 block

pug - 如何: Jade HTML content after child element

gruntjs - Grunt 自动前缀器 : No Source Files Were Found

javascript - 使用 grunt 观察并重新编译单个模板

django - 我如何告诉 grunt-usemin 忽略 Django 的静态模板标签?

css - 根据变量值将 LESS 编译成多个 CSS 文件

javascript - 使用 Express mongo 显示类别

javascript - 无法使用 express 加载 Jade View

javascript - 使用 jade 和下划线创建表格

javascript - 使用 Grunt 检索 html 主体的内容