Mul*_*vez 7 javascript templates handlebars.js
我正在尝试使用handlebars从base.html到其他模板的模板继承.但我没有得到灵魂.
拜托,任何人都可以通过简单的DEMO帮助我.使用base.html,extend.html
例如,Base.html
<html><head></head>
<body>
{% block content %}{% endblock %}
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Extend.html
{% extends "base.html" %}
{% block content %}<h1>Foobar!</h1>{% endblock %}
Run Code Online (Sandbox Code Playgroud)
我需要在base.html中包含哪些文件......?
// in my node server: using express and hbs
hbs.registerPartials(__dirname + '/built/development/templates');
app.get('/', function (req, res) {
res.render('_base', {
"STATIC_URL": app.get('STATIC_URL')
});
});
// This is in my base template
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" itemscope itemtype="http://schema.org/Article" xmlns:fb="http://ogp.me/ns/fb#"> <!--<![endif]-->
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# blog: http://ogp.me/ns/blog#">
{{> _config_logged_out }}
{{> _scripts }}
</head>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4894 次 |
| 最近记录: |