npm install -g punch
punch setup punch-site (在当前目录下,会生成punch-site目录)
cd punch-site
punch generate (此为生成静态网站的命令,在在当前目录下,会生成output目录,这个output目录就是静态网站的根目录。你可绑定一个域名到该目录)
as3:~/punch-site# punch generate
Generating site...
Created /css/site.css
Created /css/main.css
Created /css/normalize.css
Created /favicon.ico
Created /404.html
Created /index
Created /css/all.css
Completed site generation. (0.081 seconds)
Created /css/all-1382532809000.css
as3:~/punch-site# ls
config.json contents output templates
as3:~/punch-site# ls output
404.html css favicon.ico index.html
as3:~/punch-site# cd output
as3:~/punch-site/output# nohup Rwebserver 3562 > /dev/null &
[1] 28832
as3:~/punch-site/output# nohup: ignoring input and redirecting stderr to stdout
as3:~/punch-site/output#
demo site: http://as3.brite.biz:3562,(这也只是个初步框架,还需自己设计模板,放置模板文件到~/punch-site/templates/)
项目地址:https://github.com/laktek/punch
https://github.com/laktek/punch/wiki
以上的默认的网站模板太简陋了,我们可以克隆如下的模板:
git clone https://github.com/laktek/punch-blog
cd punch-blog
as3:~/punch-blog# ls
config.json helpers posts README.md
contents LICENSE-MIT package.json templates
as3:~/punch-blog# npm install
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json templates
as3:~/punch-blog# punch generate (此为生成/更新静态网站的命令)
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json public templates
(新出现了public目录)
as3:~/punch-blog# cd public
as3:~/punch-blog/public# ls
1970 css
404.html favicon.ico
about feed.rss
apple-touch-icon-114x114-precomposed.png fonts
apple-touch-icon-144x144-precomposed.png img
apple-touch-icon-57x57-precomposed.png index.html
apple-touch-icon-72x72-precomposed.png js
apple-touch-icon.png robots.txt
apple-touch-icon-precomposed.png sitemap.xml
archive tag
as3:~/punch-blog/public#
可见~/punch-blog/public/就是静态网站的根目录。
as3:~/punch-blog/public# nohup Rwebserver 3563 > /dev/null &
访问http://as3.brite.biz:3563/即可看到网站效果。
发贴方法:
as3:~/punch-blog/public# cd ..
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json public templates
as3:~/punch-blog# cd posts
as3:~/punch-blog/posts# ls
1970-01-01-lets-start.markdown
as3:~/punch-blog/posts# nano 2014-04-16-test1.markdown
按1970-01-01-lets-start.markdown的格式,新建帖子2014-04-16-test1.markdown,格式如下:
---
title: test1
published: true
tags:
- misc1
- misc2
---
这是测试1.
然后,
as3:~/punch-blog/posts# cd ..
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json public templates
as3:~/punch-blog# punch generate
演示站点:http://as3.brite.biz:3563/,http://punch.brite.biz.st
项目地址:https://github.com/laktek/punch
https://github.com/laktek/punch-blog
发布站点到外部服务器的方法:
With
You will need to specify the configurations for the preferred publishing strategy in
punch setup punch-site (在当前目录下,会生成punch-site目录)
cd punch-site
punch generate (此为生成静态网站的命令,在在当前目录下,会生成output目录,这个output目录就是静态网站的根目录。你可绑定一个域名到该目录)
as3:~/punch-site# punch generate
Generating site...
Created /css/site.css
Created /css/main.css
Created /css/normalize.css
Created /favicon.ico
Created /404.html
Created /index
Created /css/all.css
Completed site generation. (0.081 seconds)
Created /css/all-1382532809000.css
as3:~/punch-site# ls
config.json contents output templates
as3:~/punch-site# ls output
404.html css favicon.ico index.html
as3:~/punch-site# cd output
as3:~/punch-site/output# nohup Rwebserver 3562 > /dev/null &
[1] 28832
as3:~/punch-site/output# nohup: ignoring input and redirecting stderr to stdout
as3:~/punch-site/output#
demo site: http://as3.brite.biz:3562,(这也只是个初步框架,还需自己设计模板,放置模板文件到~/punch-site/templates/)
项目地址:https://github.com/laktek/punch
https://github.com/laktek/punch/wiki
以上的默认的网站模板太简陋了,我们可以克隆如下的模板:
git clone https://github.com/laktek/punch-blog
cd punch-blog
as3:~/punch-blog# ls
config.json helpers posts README.md
contents LICENSE-MIT package.json templates
as3:~/punch-blog# npm install
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json templates
as3:~/punch-blog# punch generate (此为生成/更新静态网站的命令)
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json public templates
(新出现了public目录)
as3:~/punch-blog# cd public
as3:~/punch-blog/public# ls
1970 css
404.html favicon.ico
about feed.rss
apple-touch-icon-114x114-precomposed.png fonts
apple-touch-icon-144x144-precomposed.png img
apple-touch-icon-57x57-precomposed.png index.html
apple-touch-icon-72x72-precomposed.png js
apple-touch-icon.png robots.txt
apple-touch-icon-precomposed.png sitemap.xml
archive tag
as3:~/punch-blog/public#
可见~/punch-blog/public/就是静态网站的根目录。
as3:~/punch-blog/public# nohup Rwebserver 3563 > /dev/null &
访问http://as3.brite.biz:3563/即可看到网站效果。
发贴方法:
as3:~/punch-blog/public# cd ..
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json public templates
as3:~/punch-blog# cd posts
as3:~/punch-blog/posts# ls
1970-01-01-lets-start.markdown
as3:~/punch-blog/posts# nano 2014-04-16-test1.markdown
按1970-01-01-lets-start.markdown的格式,新建帖子2014-04-16-test1.markdown,格式如下:
---
title: test1
published: true
tags:
- misc1
- misc2
---
这是测试1.
然后,
as3:~/punch-blog/posts# cd ..
as3:~/punch-blog# ls
config.json helpers node_modules posts README.md
contents LICENSE-MIT package.json public templates
as3:~/punch-blog# punch generate
演示站点:http://as3.brite.biz:3563/,http://punch.brite.biz.st
项目地址:https://github.com/laktek/punch
https://github.com/laktek/punch-blog
发布站点到外部服务器的方法:
With
”punch publish
“ command, you can publish a site to Amazon S3 or to a remote server using SFTP protocol. You will need to specify the configurations for the preferred publishing strategy in
config.json
SFTP Publishing Strategy (available as a plugin)
You can use Punch's SFTP publishing plugin to publish your site to any server with SFTP access. Go through plugin's README to learn how to install and use the plugin.Keep in Mind
- Punch will generate the site before publishing. If you don't want to generate the site, set the
generate
option tofalse
inpublish
configuration. - When a site is published, Punch will store the last published time in a hidden file named
.last_published
in the project's root directory. Next time, when you runpunch publish
it will only upload the files modified after the last published time. If you want to force upload the full site, just delete the.last_published
file. - With current publishing strategies, removed files aren't deleted from the remote servers. You will need to delete them manually.
from https://github.com/laktek/punch/wiki/Publishing-a-Site