static
1.0.0
您会喜欢的静态站点生成器。没有更多复杂的配置,肿的框架或感觉就像是被马踢在脸上!这是Spiel:
不再会站起来!静态是为了恢复简单的宝座!
确保您在计算机上安装了节点,然后在终端中复制/粘贴以下命令:
npm install -g @devdojo/static
现在,您将在计算机上提供静态命令,使您可以运行以下内容:
_site目录中可用)接下来,前往官方文档,以了解有关构建网站的更多信息。
pages目录中的每个文件都对应于您网站上的路由。以这样的结构:
pages
├── index.html
├── about.html
├── contact
│ ├── index.html
│ ├── form
│ │ ├── index.html
您的新网站将有以下路线可用:
http://localhost:3000
http://localhost:3000/about
http://localhost:3000/contact
http://localhost:3000/contact/form
设计布局可以使用多个页面。
<!DOCTYPE html >
< html lang =" en " >
< head >
< meta charset =" UTF-8 " >
< meta name =" viewport " content =" width=device-width, initial-scale=1.0 " >
< title > {title} </ title >
</ head >
< body >
{slot}
</ body >
</ html >然后,在任何页面中使用它。
<layout title="Radical Righteousness" src="main.html">
<h1>?♂️ Totally Tubuloso Website</h1>
</layout>
使用<include>标签创建可重复使用的HTML部分。用src属性指定HTML文件。
<layout title="Behind the Scenes!" src="main.html">
<include src="about-header.html"></include>
<include src="about-copy.html"></include>
</layout>
将tailwindcss快速代码添加到任何布局的<head>中,并将自动注入。例子:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{title}</title>
{tailwindcss}
</head>
<body>
{slot}
</body>
</html>
它将用dev中的尾风CDN链接替换,并且在build中将编译一个缩小的CSS文件。
将数据集添加到您的应用程序。这是位于Collections/Menu.json的示例集合
[
{
"title" : "Home",
"link" : "/"
},
{
"title" : "About",
"link" : "/about"
}
]
现在,您可以轻松地循环通过此集合:
<ForEach collection="menu">
<li>{menu.title}</h1>
</ForEach>
这些只是可用的一些热门功能,但是还有很多东西要探索和学习。
您可以通过访问官方文档来了解静态可用的所有功能。您可能也有兴趣在此处查看一些模板。
静态HTML是国王吗?