简体   繁体   English

在Grunt.js中将Processhtml与Jade一起使用

[英]Using Processhtml with Jade in Grunt.js

I would like to change the content of an HTML file for a build, like this: 我想为构建更改HTML文件的内容,如下所示:

<!-- build:css css/tidy.css -->
<link rel="stylesheet" href="css/main.css">
<!-- /build -->

To generate the HTML file I am using Jade: 要生成HTML文件,我正在使用Jade:

//
  build:css css/tidy.css
link(href='css/main.css', rel='stylesheet', type='text/css')
//
  /build

When Jade finishes creating the HTML files, this is the output: 当Jade完成创建HTML文件时,将显示以下输出:

<!--build:css css/tidy.css
-->
<link href="css/main.css" rel="stylesheet" type="text/css">
<!--/build
-->

The lack of space after the two dashes at the beginning and the line break at the end of each comment, prevent Processhtml to do its job. 每个注释的开始处的两个破折号后面和换行符处缺少空格,这使Processhtml无法执行其工作。 Is there a way to fix this automatically? 有没有一种方法可以自动解决此问题? Like an option in the task or another grunt plugin? 像任务中的选项还是另一个咕unt的插件? Thanks. 谢谢。

Try like this: 尝试这样:

// build:css css/tidy.css

Or write html directly in jade: 或直接在翡翠中编写html:

<!-- build:css css/tidy.css -->

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

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