相关疑难解决方法(0)

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

我有这个玉文件:

!!! 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文件,但我不想.

node.js pug

10
推荐指数
2
解决办法
1万
查看次数

脚本标记内的Jade条件

我正在为jade模板添加一些Javascript,而我遇到的问题是代码重复,因为我无法在脚本标记内执行任何jade条件.反正在这周围,代码如下.

if streamingType == 'HLS_IOS'
    script
        :coffee(bare=true)
         window.$j = jQuery
         window.player = new HtmlPlayer $j('#wrapper')
         player._loadVideoAt '#{url}'
else
    script
        :coffee(bare=true)
        window.$j = jQuery
        window.player = new FlashPlayer $j('#wrapper'), '#{flashPlayerId}'
        player._loadVideoAt '#{url}'`
Run Code Online (Sandbox Code Playgroud)

javascript conditional node.js pug

4
推荐指数
1
解决办法
1180
查看次数

标签 统计

node.js ×2

pug ×2

conditional ×1

javascript ×1