用 Jade 写普通 HTML
Write plain HTML in Jade
我认为可以在 Jade 文件中编写纯 HTML 作为输入,但我在尝试时遇到错误。
为此HTML
div(ng-controller="TestController")
h1 Services list
ul(ng-model="test")
li(ng-repeat="item in items")
a
| {{ item.name }}
div(ui-view)
我收到以下错误
Running "watch" task
Waiting...
>> File "app/frontend/views/home.jade" changed.
Running "jade:compile" (jade) task
>> Error: app/frontend/views/home.jade:2
>> 1| <b>hello </b> test
>> > 2| <ul ng-model="test">
>>
>> unexpected token "indent"
Warning: Jade failed to compile "app/frontend/views/home.jade".
>> Destination not written because compiled files were empty.
>> 5 files created.
Running "watch" task
Waiting...
显然是从管道开始的 |这应该有效
| Plain text can include <strong>html</strong>
p
| It must always be on its own line
jade-lang.com/reference/plain-text
输出纯文本应如下所示:
pre
<div>Stuff</div>
您需要对 HTML 文件使用 Jade 语法,而不仅仅是将纯 HTML 代码写入 .jade 文件:
doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) {
bar(1 + 5)
}
body
h1 Jade - node template engine
#container.col
if youAreUsingJade
p You are amazing
else
p Get on it!
p.
Jade is a terse and simple
templating language with a
strong focus on performance
and powerful features.
编辑:
要在 Jade 中使用普通 HTML 标签,您基本上有两种可能性:
p Plain text can include <strong>html</strong>
或| Plain text can include <strong>html</strong>
p
| It must always be on its own line
您可以在此处查看更多详细信息:http://jade-lang.com/reference/plain-text/
我认为可以在 Jade 文件中编写纯 HTML 作为输入,但我在尝试时遇到错误。
为此HTML
div(ng-controller="TestController")
h1 Services list
ul(ng-model="test")
li(ng-repeat="item in items")
a
| {{ item.name }}
div(ui-view)
我收到以下错误
Running "watch" task
Waiting...
>> File "app/frontend/views/home.jade" changed.
Running "jade:compile" (jade) task
>> Error: app/frontend/views/home.jade:2
>> 1| <b>hello </b> test
>> > 2| <ul ng-model="test">
>>
>> unexpected token "indent"
Warning: Jade failed to compile "app/frontend/views/home.jade".
>> Destination not written because compiled files were empty.
>> 5 files created.
Running "watch" task
Waiting...
显然是从管道开始的 |这应该有效
| Plain text can include <strong>html</strong>
p
| It must always be on its own line
jade-lang.com/reference/plain-text
输出纯文本应如下所示:
pre
<div>Stuff</div>
您需要对 HTML 文件使用 Jade 语法,而不仅仅是将纯 HTML 代码写入 .jade 文件:
doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) {
bar(1 + 5)
}
body
h1 Jade - node template engine
#container.col
if youAreUsingJade
p You are amazing
else
p Get on it!
p.
Jade is a terse and simple
templating language with a
strong focus on performance
and powerful features.
编辑:
要在 Jade 中使用普通 HTML 标签,您基本上有两种可能性:
p Plain text can include <strong>html</strong>
或| Plain text can include <strong>html</strong>
p
| It must always be on its own line
您可以在此处查看更多详细信息:http://jade-lang.com/reference/plain-text/