├── .gitignore ├── layout ├── src │ ├── img │ │ └── logo.png │ ├── index.html │ └── css │ │ ├── tags.css │ │ ├── mainstyle.css │ │ ├── artical.css │ │ ├── works.css │ │ └── csshake.css └── ejs │ ├── common │ ├── head.ejs │ ├── footer.ejs │ └── nav.ejs │ ├── index │ └── index.ejs │ ├── page │ └── page.ejs │ ├── tags │ ├── tagGuiding.ejs │ └── tags.ejs │ └── categories │ └── categories.ejs ├── bin └── float-site-manager.js ├── source ├── aSiteExample │ ├── src │ │ └── untitled.png │ ├── infos.json │ └── index.html └── aPageExample │ ├── index.html │ └── infos.json ├── lib ├── config.js ├── server.js ├── index.js ├── deploygit.js ├── sourceManager.js ├── extras.js └── generator.js ├── package.json ├── config.json ├── doc ├── README.md └── USAGE.md ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | public/ 3 | __deploy/ 4 | source/fileRecord.json 5 | package-lock.json -------------------------------------------------------------------------------- /layout/src/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fltb/float-site-manager-npm/HEAD/layout/src/img/logo.png -------------------------------------------------------------------------------- /bin/float-site-manager.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | "use strict"; 4 | 5 | const main = require("../lib/index"); 6 | 7 | main(); 8 | -------------------------------------------------------------------------------- /source/aSiteExample/src/untitled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fltb/float-site-manager-npm/HEAD/source/aSiteExample/src/untitled.png -------------------------------------------------------------------------------- /layout/src/index.html: -------------------------------------------------------------------------------- 1 | 2 |
This is Float's site.
5 |First Paragraph.
4 | 5 |Second Paragraph.
6 | 7 |Welcome to the Child site
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/lib/server.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | const express = require("express");
4 |
5 | const app = express();
6 |
7 | app.use(express.static("public"));
8 |
9 | const server = {
10 | start: function(port) {
11 | if (port === undefined || !Number.isInteger(port)) {
12 | port = 4000;
13 | }
14 | console.log("Server started at http://localhost:" + port);
15 | console.log("Use Ctrl+C to stop");
16 | app.listen(port);
17 | }
18 | }
19 |
20 | module.exports = server;
--------------------------------------------------------------------------------
/layout/ejs/common/nav.ejs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/layout/ejs/index/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <%- include('../common/head.ejs', {page: page}); %>
6 |
7 | <%= now.description %>
28 |<%= now.description %>
39 |第一段内容.
195 |第二段内容.
196 | ``` 197 | 198 | “而不是这样:” 199 | 200 | ``` html 201 | 202 | 203 | 204 |第一段内容.
209 |第二段内容.
210 | 211 | 212 | ``` 213 | 214 | {为什么要这样子呢?} 215 | 216 | “因为这样子,渲染的时候就会自动填充进页面里面去。如果要对页面的模板进行改动,就不需要一个一个页面改过来了。” 217 | 218 | {如果我想要加入一些资源,比如图片,要怎么办?} 219 | 220 | “直接往里面加就好了嘛,一个文件夹就相当于一个子网站,里面的所有其他文件都会被直接复制到渲染好的网站的对应目录下面,所以你要给 PageA 加上图片的话,直接用 img 标签就行了。” 221 | 222 | “假设目录结构如下:” 223 | 224 | ``` text 225 | - source/ 226 | - PageA/ 227 | - img.png 228 | - index.html 229 | - infos.json 230 | ``` 231 | 232 | “ HTML 就可以写成这样” 233 | 234 | ``` html 235 |
236 | ```
237 |
238 | {如果我的页面不使用网站的默认模板,是不是最好要选择 site 类型?}
239 |
240 | “对了,不然我写这东西干嘛。自定义程度很高的需求就需要这样了。site 类型下面,除了 infos.json,其他的都可以当成是一个完整的网站来看待。”
241 |
242 | {假如我已经搞好了页面,下一步怎么做?}
243 |
244 | “肯定是生成+测试啊。最后再部署上去。”
245 |
246 | “因为现在整个网站还是源码阶段,就是都在 source 文件夹里面,所以需要渲染成一个完整可用的网站。这个过程是自动化的,你只要一条命令就可以了。完成之后你可以看到一个 public 文件夹,里面就是渲染好了的文件。source 目录下面也会多出来一个 fileRecord.json。生成出来的文件最好别动。”
247 |
248 | ``` sh
249 | npx float-site-manager g
250 | ```
251 |
252 | {输出了一大堆东西,不过文件夹倒是有了。}
253 |
254 | “输出啥的不用管他,只是为了说明它在正常运行。”
255 |
256 | “现在运行一下网站测试它吧。跑一跑下面的命令。然后打开