如何在jade中包含css文件(不链接它)

use*_*370 10 node.js pug

我有这个玉文件:

!!! 5
html
  head
    title test include
    style(type='text/css')
      //- DOES NOT WORK!
      include test.css
  body
    //- works
    include test.css
    div 
      //- works
      include test.css
Run Code Online (Sandbox Code Playgroud)

输出:

$ jade -P test.jade 
rendered test.html
$ cat test.html
<!DOCTYPE html>
<html>
  <head>
    <title>test include</title>
    <style type="text/css">
      //- DOES NOT WORK!
      include test.css
    </style>
  </head>
  <body>body { color: peachpuff; }

    <div> body { color: peachpuff; }

    </div>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

当然,我可以简单地链接css文件,但我不想.

Arn*_*uin 13

我还没有测试它(不是在我的开发计算机ATM上),但有可能做这样的事情可以工作:

!!!
head
  title test include
  | <style type='text/css'>
  include test.css
  | </style>
Run Code Online (Sandbox Code Playgroud)

顺便说一句,我找到了HTML2Jade在线转换器,但没有找到Jade2HTML.知道在哪里找到它?


Fiz*_*han 9

来自玉文档:

doctype html
html
  head
    style
      include style.css
  body
    h1 My Site
    p Welcome to my super lame site.
Run Code Online (Sandbox Code Playgroud)

它完美无缺.