欢迎光临
我们一直在努力

OSChina支持Pages功能了

This is not a new function supported by OSChina, but I’m just aware of that yesterday. Long time ago, I had once made a choice whether to use github or OSChina to be the repository storing my public code, and I finally use github later due to the fact that I found OSChina seems to have to function like github Pages. You know, as I front end developer, it’s import to show not both your code but also its visual display to others. Therefore, functions like github pages are very meaningful to me and it’s also very convenient. Without functions like github pages, I will need to build my code and then use FTP/SFTP tools like FileZilla to upload my frontend static files to my server. If you change your code in high frequency, you will find this way quite time-wasting. Whereas if you use github pages, all you need to do after rebuild your code is type one line’s command in your command line tools and press enter button ^_^.

Using Github Pages

Right. There is a npm package called “gh-pages”. If your built files are stored in a folder named “src” in the root directory of your project. You can add one custom script in your package.json file like below:

The scripts “gh-pages -d dist” will deploy all your code under dist folder to a remote branch in github called “gh-pages”, and then you can visit your project online through link like “http://yakima-teng.github.io/demos/” in which “yakima-teng” should be replaced by your github user name and “demos” should be replaced by your project name of your github repository.

Using OSChina Pages

Although there is strings “gh” in the name of the npm package “gh-pages”, this package is also available to use for OSChina Pages. As per the official npm website for this package, you can find many custom options. In short, if:

  • your files need to be visited online are all built to a folder called dist in your project root,
  • you want to use a remote branch called “oschina-pages” to be used for online display purpose,
  • your remote git repository address is “https://git.oschina.net/yakima/demos.git”.

You can add a script alias (short name) “deployToOSChina” in your package.json file like below:

Yakima Teng,

August 28, 2017,

In Shanghai, China

赞(0) 打赏(金额可任意指定)
未经允许不得转载:峰间的云 » OSChina支持Pages功能了
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

上海宝山顾村棉被加工店 专业加工新旧棉被

查看详情了解一下

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏