refactor(ssr): for test
This commit is contained in:
parent
1acfdd335c
commit
891475e132
8 changed files with 80 additions and 6 deletions
|
|
@ -1,2 +1,3 @@
|
||||||
.git/
|
.git/
|
||||||
packages/docsify-server-renderer/build.js
|
packages/docsify-server-renderer/build.js
|
||||||
|
node_modules
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
"extends": [
|
"extends": [
|
||||||
"vue"
|
"vue"
|
||||||
],
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 8
|
||||||
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true
|
"browser": true
|
||||||
},
|
},
|
||||||
|
|
|
||||||
13
app.js
13
app.js
|
|
@ -22,11 +22,16 @@ var renderer = new Renderer({
|
||||||
config: {
|
config: {
|
||||||
name: 'docsify',
|
name: 'docsify',
|
||||||
repo: 'qingwei-li/docsify',
|
repo: 'qingwei-li/docsify',
|
||||||
basePath: '/docs/',
|
basePath: 'https://docsify.js.org/',
|
||||||
loadNavbar: true,
|
loadNavbar: true,
|
||||||
loadSidebar: true,
|
loadSidebar: true,
|
||||||
subMaxLevel: 3,
|
subMaxLevel: 3,
|
||||||
auto2top: true
|
auto2top: true,
|
||||||
|
alias: {
|
||||||
|
'/de-de/changelog': '/changelog',
|
||||||
|
'/zh-cn/changelog': '/changelog',
|
||||||
|
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
path: './'
|
path: './'
|
||||||
})
|
})
|
||||||
|
|
@ -34,8 +39,8 @@ var renderer = new Renderer({
|
||||||
http.createServer(function (req, res) {
|
http.createServer(function (req, res) {
|
||||||
serveStatic('.')(req, res, function () {
|
serveStatic('.')(req, res, function () {
|
||||||
// TEST SSR
|
// TEST SSR
|
||||||
// const html = renderer.renderToString(req.url)
|
// renderer.renderToString(req.url)
|
||||||
// res.end(html)
|
// .then(html => res.end(html))
|
||||||
|
|
||||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||||||
res.end(fs.readFileSync('dev.html'))
|
res.end(fs.readFileSync('dev.html'))
|
||||||
|
|
|
||||||
29
docs/ssr.config.js
Normal file
29
docs/ssr.config.js
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
module.exports = {
|
||||||
|
alias: {
|
||||||
|
'/de-de/changelog': '/changelog',
|
||||||
|
'/zh-cn/changelog': '/changelog',
|
||||||
|
'/changelog': 'https://raw.githubusercontent.com/QingWei-Li/docsify/master/CHANGELOG'
|
||||||
|
},
|
||||||
|
auto2top: true,
|
||||||
|
coverpage: true,
|
||||||
|
executeScript: true,
|
||||||
|
loadSidebar: true,
|
||||||
|
loadNavbar: true,
|
||||||
|
mergeNavbar: true,
|
||||||
|
maxLevel: 4,
|
||||||
|
subMaxLevel: 2,
|
||||||
|
name: 'docsify',
|
||||||
|
search: {
|
||||||
|
noData: {
|
||||||
|
'/de-de/': 'Keine Ergebnisse!',
|
||||||
|
'/zh-cn/': '没有结果!',
|
||||||
|
'/': 'No results!'
|
||||||
|
},
|
||||||
|
paths: 'auto',
|
||||||
|
placeholder: {
|
||||||
|
'/de-de/': 'Suche',
|
||||||
|
'/zh-cn/': '搜索',
|
||||||
|
'/': 'Search'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
29
docs/ssr.html
Normal file
29
docs/ssr.html
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>docsify</title>
|
||||||
|
<link rel="icon" href="_media/favicon.ico">
|
||||||
|
<meta name="keywords" content="doc,docs,documentation,gitbook,creator,generator,github,jekyll,github-pages">
|
||||||
|
<meta name="description" content="A magical documentation generator.">
|
||||||
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="//unpkg.com/docsify@next/lib/themes/vue.css" title="vue">
|
||||||
|
<link rel="stylesheet" href="//unpkg.com/docsify@next/lib/themes/dark.css" title="dark" disabled>
|
||||||
|
<link rel="stylesheet" href="//unpkg.com/docsify@next/lib/themes/buble.css" title="buble" disabled>
|
||||||
|
<link rel="stylesheet" href="//unpkg.com/docsify@next/lib/themes/pure.css" title="pure" disabled>
|
||||||
|
<style>
|
||||||
|
nav.app-nav li ul {
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!--inject-app-->
|
||||||
|
<!--inject-config-->
|
||||||
|
</body>
|
||||||
|
<script src="//unpkg.com/docsify@next/lib/docsify.min.js"></script>
|
||||||
|
<script src="//unpkg.com/docsify@next/lib/plugins/search.min.js"></script>
|
||||||
|
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||||
|
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
|
||||||
|
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
|
||||||
|
</html>
|
||||||
3
docs/ssr.md
Normal file
3
docs/ssr.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Server client renderer
|
||||||
|
|
||||||
|
See https://docsify.now.sh
|
||||||
|
|
@ -26,6 +26,10 @@
|
||||||
"build:ssr": "node build/build-ssr",
|
"build:ssr": "node build/build-ssr",
|
||||||
"test": "eslint {src,packages} --fix"
|
"test": "eslint {src,packages} --fix"
|
||||||
},
|
},
|
||||||
|
"docsify": {
|
||||||
|
"path": "./",
|
||||||
|
"template": "./ssr.html"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"marked": "^0.3.6",
|
"marked": "^0.3.6",
|
||||||
"prismjs": "^1.6.0",
|
"prismjs": "^1.6.0",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue