Arr*_*uda 9 templates block pug
您好,我正在尝试使用Jade的块并扩展为node.js项目,而ideia是这样的:
layout.jade:
head
script
$(document).ready(function() {
block js_doc_ready
//here goes the doc ready
});
Run Code Online (Sandbox Code Playgroud)
index.jade:
block js_doc_ready
alert('hello!');
alert('one more js line code');
alert('end my js doc ready for this view');
Run Code Online (Sandbox Code Playgroud)
这会给我一个像这样的index.html:
...
<head>
<script type="text/javascript">
$(document).ready(function() {
alert('hello!');
alert('one more js line code');
alert('end my js doc ready for this view');
});
</script>
</head>
...
Run Code Online (Sandbox Code Playgroud)
但是当我看到结果时,'block js_doc_ready'不被视为Jade块.此外,即使它被认为是块,"警报('你好!);' 不会被认为是a,而是Jade标签.
这是我以前在django模板中所做的事情,但是在使用所有这些标签的玉器中,没有做纯HTML的自由我仍然觉得制作这个东西有点太奇怪了.
Arn*_*uin 23
Jade不会翻译'style'和'script'代码中的内容.决不.
什么工作是基于我给另一个问题的答案(使用样式元素,但基本相同).
!!!
head
title Hello jade
| <script type='text/javascript'>
| $(document).ready(function() {
block js_doc_ready
| });
| </script>
Run Code Online (Sandbox Code Playgroud)
这样:jade将包含HTML'script'标签和$ .ready行,但也包括你的块.
| 归档时间: |
|
| 查看次数: |
13688 次 |
| 最近记录: |