我有这个玉文件:
!!! 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文件,但我不想.
我正在为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)