Ale*_*kii 3 template-engine google-chrome node.js pug
我正在使用Jade作为我的Express动力node.js应用程序的模板引擎.也许是深夜,但我无法弄清楚style在结果HTML中插入空元素的位置.
实例:http://quotation-mark.herokuapp.com/(注意到<style type="text/css"></style>最后head?)
app.set('views', settings.projectDir + '/views');
app.set('view engine', 'jade');
app.set('view options', {layout: false});
Run Code Online (Sandbox Code Playgroud)
!!!html
include /helpers/css.jade
html(lang='ru')
head
meta(http-equiv='content-type', content='text/html; charset=utf-8')
noscript
meta(http-equiv="refresh", content="0; url=/noscript")
title= title
block css
mixin css('/css/bootstrap/bootstrap.css')
body
block content
Run Code Online (Sandbox Code Playgroud)
extends layout
append content
h1= title
p ????? ?????????? ? #{title}.
Run Code Online (Sandbox Code Playgroud)
即使head模板本身没有,浏览器中也有一个(Chrome 19.0.1084.53),也许浏览器会添加一些东西?简单的HTML页面没有它:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style>h1{color:red;}</style>
</head>
<body>
<h1>Hi!</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
jim*_*imr 10
服务器生成的HTML实际上没有空<style>块.
<!DOCTYPE html><html lang="ru">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<noscript><meta http-equiv="refresh" content="0; url=/noscript"></noscript>
<title>«???????»</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<h1>«???????»</h1><p>????? ?????????? ? «???????».</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
您是否正在使用AdBlock等任何浏览器扩展程序?当AdBlock打开时,我在我访问的每个页面中看到空样式块.禁用扩展程序会使其消失.
| 归档时间: |
|
| 查看次数: |
2626 次 |
| 最近记录: |