-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
55 lines (54 loc) · 1.42 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Dependencies
// =============================================================================
const browserSync = require('browser-sync').create();
const compression = require('compression');
browserSync.init({
files: [
'./demo/**/*',
'./docs/**/*',
'./src/demo/static/**/*'
],
ghostMode: {
clicks: false,
forms : false,
scroll: false
},
open: false,
notify: false,
reloadOnRestart: true,
reloadDebounce: 500,
server: {
baseDir: [
'./docs'
],
middleware: [
compression()
],
routes: {
'/demo' : './demo',
'/CHANGELOG.md': './CHANGELOG.md'
}
},
serveStatic: [
'./src/demo/static',
{ route: '/demo', dir: './dist' }
],
snippetOptions: {
// Prevent injection of browser-sync-client.js in IE < 9.
// Allows browsersync to serve pages to older versions of IE without
// errors, but requires manual refreshing pages to view changes.
rule: {
match: /<\/body>/i,
fn: function (snippet, match, x) {
return `<!--[if gt IE 8]><!-- -->${snippet}${match}<![endif]-->`;
}
}
},
rewriteRules: [
// Replace CDN URLs with local paths
{
match: /https?.*\/CHANGELOG.md/g,
replace: '/CHANGELOG.md'
}
]
});