【发布时间】:2012-05-15 06:54:26
【问题描述】:
我有这个玉文件:
!!! 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
输出:
$ 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>
当然,我可以简单地链接 css 文件,但我不想这样做。
【问题讨论】:
-
我不认为这是可能的,但为什么不是简单的解决方案?
-
我猜您想在服务器文件中将 CSS 与 HTML 分开,但在 html 中提供样式以避免额外请求获取 CSS。这是错误的:您为一个不会每次都请求的文件添加额外的计算(文件包含),因为它会被缓存。