繁体   English   中英

将玉器文件保存为具有相同名称的html

[英]Save jade file to html with same name

试图让翡翠将我的翡翠文件另存为HTML文件,同时保持相同的文件名。

因此,文件views/index.jade应该另存为dist/index.html

其他文件也一样。

我正在使用grunt-contrib-jade

我的Gruntfile的玉器配置:

module.exports = function(grunt){
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jade: {
      compile: {
        options: {
          pretty: true
        },
        files: {
          'dist/*.html': ['views/*.jade']
        }
      }
    }

  });
  grunt.loadNpmTasks('grunt-contrib-jade');
  grunt.registerTask('default', ['jade']);
};

但这只是将文件另存为*.html

我认为它正在执行您要执行的操作。 尝试以下配置jade任务:

jade: {
    compile: {
        options: {
            pretty: true
        },
        files: [{
            expand: true, // setting to true enables the following options
            cwd: '/jade', // src matches are relative to this path
            src: ['{,*/}*.jade'], // matches *.jade in cwd and 1 level down
            dest: 'dist/', // destination prefix
            ext: '.html' // replace existing extensions with this value
        }]
    }
}

这是有关使用Grunt动态构建文件列表的一些信息。

暂无
暂无

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

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