如何在 jade 中包含一个 css 文件(不链接它) [英] How to include a css file in jade (without linking it)

查看:73
本文介绍了如何在 jade 中包含一个 css 文件(不链接它)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个玉文件:

<代码>!!!5html头标题测试包括样式(类型='文本/CSS')//- 不起作用!包括 test.css身体//- 有效包括 test.cssdiv//- 有效包括 test.css

输出:

$ jade -P test.jade呈现的 test.html$猫测试.html<!DOCTYPE html><头><title>测试包括</title><style type="text/css">//- 不起作用!包括 test.css</风格><body>body { color: peachpuff;}<div>身体{颜色:peachpuff;}

</html>

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

解决方案

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

<代码>!!!头标题测试包括|<style type='text/css'>包括 test.css|</风格>

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

I have this jade file:

!!! 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

The output:

$ 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>

Of course, I could simply link the css-file, but I do not want to.

解决方案

I didn't test it yet (not on my dev computer ATM) but there is a chance doing something like this could work :

!!!
head
  title test include
  | <style type='text/css'>
  include test.css
  | </style>

By the way, I found the HTML2Jade online converter but not the Jade2HTML. Any idea where to find it ?

这篇关于如何在 jade 中包含一个 css 文件(不链接它)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆