-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathbrowsersync.config.js
More file actions
50 lines (43 loc) · 969 Bytes
/
browsersync.config.js
File metadata and controls
50 lines (43 loc) · 969 Bytes
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
const fs = require('fs')
const yaml = require('js-yaml')
const portfinder = require('portfinder')
let landoProjectName = 'sample'
try {
if (fs.existsSync('../../../../.lando.yml')) {
let fileContents = fs.readFileSync('../../../../.lando.yml', 'utf8')
let data = yaml.load(fileContents)
if (data.name) {
landoProjectName = data.name
}
}
} catch (e) {
console.log(e)
}
// BrowserSync options
const browserSyncOptions = {
port: 3000,
proxy: `https://${landoProjectName}.lndo.site/`,
https: true,
injectChanges: true,
files: ['*.php', '**/*.php', 'dist/*.css', 'dist/*.js', 'dist/icons/*.svg'],
startPath: '/',
notify: true,
open: false,
}
// Plugin options
const pluginOptions = {
injectCss: true,
}
portfinder.getPort(
{
port: 3000, // default port
stopPort: 3333, // maximum port
},
function (port) {
browserSyncOptions.port = port
}
)
module.exports = {
browserSyncOptions,
pluginOptions,
}