如何编译部署 UIKit 离线文档?

如何编译部署 UIKit 离线文档?

Whis is UIKit?
Note:部署在 Windows 系统会出现路径错误情况,这里采用在 Debian 系统上进行编译和部署。

1. 安装一些前置工具

CurlGitNodeYarn

# 更新仓库
apt-get update

# 安装 curl
apt-get install curl

# 安装 git
apt-get install git

# 安装 node
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs

# 安装 yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt-get update && apt-get install yarn

2. 克隆仓库代码

mkdir /home/localhost
cd /home/localhost
git clone https://github.com/uikit/uikit-site.git

3. 编译

cd uikit-site
yarn install
yarn setup

4. 部署

使用 golang 语言进行部署

源文件 main.go

package main

import (
	"fmt"
	"net/http"
)

func main() {
	fmt.Println("Zeros")
	http.Handle("/", http.FileServer(http.Dir("/home/localhost/uikit-site/")))
	http.ListenAndServe(":10086", nil)
}

使用 浏览器访问 http://127.0.0.1:10086 即可.

Node:在 linux 部署时注意赋予文件足够权限。

这里我是把编译完的文件复制到 windows 进行部署的,需要复制 uikit-site/node_modules/uikit/dist 文件夹至 uikit-site/assets/uikit 目录。使用 linux 不需要该操作

原文地址:https://www.cnblogs.com/cheungxiongwei/p/10438521.html