-
-
Notifications
You must be signed in to change notification settings - Fork 269
/
server.js
32 lines (30 loc) · 776 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as path from 'node:path';
import * as url from 'node:url';
import { create } from 'browser-sync';
import { rewriteRules } from './middleware.js';
import compression from 'compression';
const __filename = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const bsServer = create();
bsServer.init({
files: ['./dist/**/*.*', './docs/**/*.*'],
ghostMode: {
clicks: false,
forms: false,
scroll: false
},
open: false,
notify: false,
cors: true,
reloadDebounce: 1000,
reloadOnRestart: true,
rewriteRules,
server: {
baseDir: './docs',
middleware: [compression()],
routes: {
'/changelog.md': path.resolve(__dirname, 'CHANGELOG.md'),
'/dist': path.resolve(__dirname, 'dist')
}
}
});