Repository navigation
Expand file tree
/
Copy pathbs-config.js
More file actions
52 lines (51 loc) · 1.37 KB
/
Copy pathbs-config.js
File metadata and controls
52 lines (51 loc) · 1.37 KB
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
// Browsersync configuration for proxying mastodon.test
// This allows you to develop mastodon-bird-ui CSS while testing against your real Mastodon instance
// VARIANT env var picks the CSS file, e.g. mastodon-bird-ui-accessible
const variant = process.env.VARIANT;
const cssFile = variant || 'mastodon-bird-ui';
module.exports = {
proxy: {
target: 'https://mementomori.test',
proxyOptions: {
secure: false, // Allow self-signed certificates
},
proxyRes: [
function (proxyRes) {
// Remove CSP header so Browsersync's injected script can run
delete proxyRes.headers['content-security-policy'];
},
],
},
port: 3999,
files: ['dist/*.css'],
https: false,
serveStatic: [
{
route: '/mastodon-bird-ui',
dir: 'dist',
},
],
snippetOptions: {
rule: {
match: /<\/head>/i,
fn: function (snippet, match) {
// Inject CSS before </head>
const cssInjection = `<link rel="stylesheet" href="/mastodon-bird-ui/${cssFile}.css">\n`;
return cssInjection + snippet + match;
},
},
},
open: false,
notify: true,
logLevel: 'debug',
logPrefix: 'Mastodon Bird UI',
reloadDelay: 0,
reloadDebounce: 100,
injectChanges: true,
watchEvents: ['change', 'add'],
watchOptions: {
usePolling: true,
interval: 500,
},
ignore: ['node_modules', '.git', '*.map'],
};