我正在使用Flask开发应用程序。我决定将其用作前端框架Zurb-Foundation。我发现有一个Flask-Zurb-Foundation。根据要使用它的文档,您要做的就是
from flask_zurb_foundation import Foundation
[...] # your initiation code here
Foundation(app)
然后,您将拥有一个“ foundation / base.html”模板,可以开始开发您的项目。
但是,我找不到使用此“ foundation / base.html”来生成基本布局模板并将其扩展到其他子模板的方法。
我决定采用以下方式直接将Zurb-Foundation与Sass一起使用Koala(使用Jinja和预处理器Flask-Zurb-Foundation):
<!doctype html>
<html class="no-js" lang="">
<head>
{% block head %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content=" Flask and Foundation Test">
<link rel="apple-touch-icon" href="static/img/apple-icon.png">
<link rel="shortcut icon" href="static/img/favicon.png" type="image/png">
<link rel="stylesheet" href="static/css/foundation.css">
<link rel="stylesheet" href="static/css/styles.css">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Varela+Round">
<link rel="stylesheet" type="text/css" href="static/foundation-icons/foundation_icons_social/stylesheets/social_foundicons.css">
<title>{% block title %}{% endblock %}</title>
{% endblock head%}
</head>
<body>
{% block navbar %}
<!-- Navbar html code here to use it in child templates -->
{% endblock navbar %}
<div class="content-body">
{% block content %}{% endblock content %}
</div>
{% block footer %}
<!-- footer html code here to use it in child templates -->
{% endblock footer %}
{% block scripts %}
<!-- scripts code here to use it in child templates -->
<script src="../static/js/foundation.min.js"></script>
{% endblock scripts %}
</body>
</html>
然后按如下所示创建我的子模板:
{% extends "base.html" %}
{% block title %}Another child template{% endblock title %}
{% block content %}
<h1>Another child template</h1>
{% endblock content %}
一切正常。我的问题是:与Zurb-Foundation一起使用,而不是像我一样直接使用https://cpan.metacpan.org/authors/id/S/SZ/SZBALINT/WWW-Curl-4.17.tar.gz,有什么好处吗?