-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbs-config.js
42 lines (35 loc) · 1.61 KB
/
bs-config.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
module.exports = {
// By default we proxy all requests to the remote server
//proxy: 'staging.ourawesomewebsite.tld',
server: {
baseDir: "./"
},
// But we still ask BrowserSync to watch changes in our local files
files: [
"assets/css/*.css",
"assets/js/*.js",
"*.html"
],
// Now when a file is changed, BrowserSync in the browser updates the
// corresponding src/href (which it finds through SHEER MAGIC as far as
// I know) to include a new query string, which prompts the browser to
// request the file again.
// By default that request would be proxied to the remote server,
// but let pipe it through a middleware first.
//middleware: require('serve-static')('public'),
// Now we have asked serve-static to serve the requested file if it can
// find it in the local `public` folder. If it doesn't find it, it
// gives the control back to BrowserSync's proxy, so we end up looking
// for an updated version of the file on the remote server (not good,
// because in this workflow the file won't have our local changes).
// Simple situation: if the URLs for static files look like
// `/assets/css/styles.css` (for example) and in your `public` folder
// you have `public/assets/css/styles.css`, perfect! You can stop here.
// But if the URLs are constructed differently, you will need to
// rewrite them first. So we use rewriteRules, and the execution
// order becomes: 1) browser-sync rewrites URLs, 2) serve-static looks
// for the rewritten URLs in your local folder, 3) falls back to proxy
// if (2) fails.
// WE'RE DONE! update the paths, and run with:
// $ browser-sync --config bs-config.js
}