I'm trying to compile Jade files to HTML and put them in a directory. Currently when I compile, the created HTML files are going into the right directory but they are within a created directory called jade.

Here is my directory structure:

  • jade
  • html

But after compile it looks like this:

  • jade
  • html/jade

Ideally I just want the HTML files to go into the html directory and not within a jade directory.

Here is the relevant part of my gruntfile:

jade: {
  compile: {
      files: [{
          expand: true,
          src: ['jade/**/*.jade'],
          dest: 'html/',
          ext: '.html'
      }]
  }
}
有帮助吗?

解决方案

Output structure mirrors the src option. Try the cwd option.

Refer to: 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归因
不隶属于 StackOverflow
scroll top