简体   繁体   English

用Grunt将Jade编译到特定目录

[英]Compiling Jade with Grunt to a specific directory

I'm trying to compile Jade files to HTML and put them in a directory. 我正在尝试将Jade文件编译为HTML并将它们放在目录中。 Currently when I compile, the created HTML files are going into the right directory but they are within a created directory called jade. 目前,当我编译时,创建的HTML文件将进入正确的目录,但它们位于名为jade的创建目录中。

Here is my directory structure: 这是我的目录结构:

  • jade
  • html html

But after compile it looks like this: 但是编译后看起来像这样:

  • jade
  • html/jade html / jade

Ideally I just want the HTML files to go into the html directory and not within a jade directory. 理想情况下,我只希望HTML文件进入html目录而不是jade目录。

Here is the relevant part of my gruntfile: 这是我的gruntfile的相关部分:

jade: {
  compile: {
      files: [{
          expand: true,
          src: ['jade/**/*.jade'],
          dest: 'html/',
          ext: '.html'
      }]
  }
}

Output structure mirrors the src option. 输出结构镜像src选项。 Try the cwd option. 尝试使用cwd选项。

Refer to: http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically 请参考: http : //gruntjs.com/configuring-tasks#building-the-files-object-dynamically

Example: 例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM