Pages

Thursday, 30 March 2017

搭建基于nodejs的静态网站程序loppo

首先搭建nodejs环境。

npm install loppo -g
cd /usr/local
mkdir loppo-site
cd loppo-site
mkdir docs
cd docs
 
root@localhost:/usr/local/loppo-site# ls
docs 
root@localhost:/usr/local/loppo-site# cd docs
root@localhost:/usr/local/loppo-site/docs# nano page1.md
root@localhost:/usr/local/loppo-site/docs# cat page1.md
# 测试1

这是测试1.

看看如何?
root@localhost:/usr/local/loppo-site/docs# cd ..
root@localhost:/usr/local/loppo-site# loppo 
(此即生成/更新静态网站的根目录的命令)
root@localhost:/usr/local/loppo-site# ls
chapters.yml  dist  docs  loppo.yml  themes
(第一次运行loppo命令,除了生成dist目录外,还会生成
chapters.yml loppo.yml  themes)
root@localhost:/usr/local/loppo-site# cd dist
root@localhost:/usr/local/loppo-site/dist# ls
assets  index.html favicon.ico  page1.html 
root@localhost:/usr/local/loppo-site/dist#
(可见/usr/local/loppo-site/dist就是静态网站的根目录)
 
以后在/usr/local/loppo-site/docs里再次新建源帖后,需修改
/usr/local/loppo-site/chapters.yml文件如下:
root@localhost:/usr/local/loppo-site# cat chapters.yml

- page4.md: 因为我爱你
- page3.md: 稀奇古怪的中国经济
- page2.md: 测试2
- page1.md: 测试1
root@localhost:/usr/local/loppo-site#
(即需在第一行“- page1.md: 测试1”的上方加上“- page2.md: 测试2“,然后
root@localhost:/usr/local/loppo-site# loppo
 
演示网站:http://loppo.bright.biz.st/
项目地址:https://github.com/ruanyf/loppo
https://github.com/ruanyf/loppo/issues/7

 

No comments:

Post a Comment