1 Star 0 Fork 125

hzhlu/docsify

forked from docsifyjs/docsify 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server.configs.js 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
John Hildenbiddle 提交于 2024-07-19 11:34 . feat: v5 style overhaul (#2469)
import * as path from 'node:path';
import * as url from 'node:url';
import { rewriteRules } from './middleware.js';
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Production (CDN URLs, watch disabled)
export const prodConfig = {
ghostMode: false,
hostname: '127.0.0.1',
notify: false,
open: false,
port: 8080,
server: {
baseDir: './docs',
},
snippet: false,
ui: false,
};
// Development (local URLs, watch enabled)
export const devConfig = {
...prodConfig,
files: ['CHANGELOG.md', 'docs/**/*', 'dist/**/*'],
port: 3000,
rewriteRules,
reloadDebounce: 1000,
reloadOnRestart: true,
server: {
...prodConfig.server,
routes: {
'/changelog.md': path.resolve(__dirname, 'CHANGELOG.md'),
'/dist': path.resolve(__dirname, 'dist'),
'/node_modules': path.resolve(__dirname, 'node_modules'), // Required for automated Vue tests
},
},
snippet: true,
};
// Test (local URLs, watch disabled)
export const testConfig = {
...devConfig,
port: 4000,
server: {
...devConfig.server,
middleware: [
// Blank page required for test environment
{
route: '/_blank.html',
handle(req, res, next) {
res.setHeader('Content-Type', 'text/html');
res.end('<!DOCTYPE html><html><body></body></html>');
next();
},
},
],
},
snippet: false,
watch: false,
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hzhlu/docsify.git
[email protected]:hzhlu/docsify.git
hzhlu
docsify
docsify
develop

搜索帮助