Skip to content

Commit 0cff56a

Browse files
committed
Adds Browser Sync config for docs.
1 parent 1b70641 commit 0cff56a

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ You can build the documentation using Docker via the following commands:
7575

7676
# open the generated html docs in docs/_build/html
7777

78+
# or use Browser Sync with automatic builds and browser refresh on file save
79+
browser-sync start --config browser-sync-config.js
80+
7881
# Additional Resources
7982

8083
* [CakePHP coding standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html)

docs/browser-sync-config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const { exec } = require("child_process");
2+
3+
const docker = "docker run --rm -v $(pwd):/data friendsofcake/crud make html";
4+
5+
module.exports = {
6+
server: {
7+
baseDir: "_build/html",
8+
index: "index.html"
9+
},
10+
11+
files: [
12+
"_build/html/*.html",
13+
{
14+
match: ["**/*.rst", "**/*.php"],
15+
fn: (event) => {
16+
if (event !== 'change') {
17+
return false;
18+
}
19+
exec(docker, (error, stdout, stderr) => {
20+
if (error) {
21+
console.error(error);
22+
return;
23+
}
24+
console.log(stdout);
25+
});
26+
return false;
27+
},
28+
options: {
29+
ignored: '_build'
30+
}
31+
}
32+
]
33+
};

0 commit comments

Comments
 (0)