我使用服务器端包含来组织我的文件。
嵌套文件似乎不起作用。例如:-
index.shtml - 这很好用
<!doctype html>
<html lang="en">
<!--#include virtual="partials/head.shtml"-->
<body>
<!--#include virtual="partials/components/ads/horizontal-banner.shtml"-->
<div id="site-wrapper">
<header id="site-header">
<!--#include virtual="partials/header.shtml"-->
</header>
<div id="site-body">
<!--#include virtual="partials/pages/home.shtml"-->
</div>
<footer id="site-footer">
<!--#include virtual="partials/footer.shtml"-->
</footer>
</div>
<!--#include virtual="partials/common.shtml"-->
在home.shtml中,还有另一个调用
<!--#include virtual="../components/newsletter.shtml"-->
以下是项目结构:-
project
- css
- assets
- js
- partials
- components
- ads
horizontal-banner.shtml
vertical-banner.shtml
newsletter.shtml
help.shtml
- pages
home.shtml
about.shtml
header.shtml
footer.shtml
head.shtml
common.shtml
index.shtml