|
1 |
| -# ddev-browsersync <!-- omit in toc --> |
| 1 | +[](https://github.com/ddev/ddev-browsersync/actions/workflows/tests.yml?query=branch%3Amain) |
| 2 | +[](https://github.com/ddev/ddev-browsersync/commits) |
| 3 | +[](https://github.com/ddev/ddev-browsersync/releases/latest) |
2 | 4 |
|
3 |
| -[](https://github.com/ddev/ddev-browsersync/actions/workflows/tests.yml)  |
| 5 | +# DDEV Browsersync <!-- omit in toc --> |
4 | 6 |
|
5 |
| -- [Introduction](#introduction) |
6 |
| -- [Getting Started](#getting-started) |
| 7 | +- [Overview](#overview) |
| 8 | +- [Installation](#installation) |
| 9 | +- [Usage](#usage) |
7 | 10 | - [Auto-start the watcher server](#auto-start-the-watcher-server)
|
8 | 11 | - [What does this add-on do?](#what-does-this-add-on-do)
|
9 | 12 | - [Integrations](#integrations)
|
|
14 | 17 | - [No Gateway / 502 error](#no-gateway--502-error)
|
15 | 18 | - [Unknown command "browsersync" for "ddev"](#unknown-command-browsersync-for-ddev)
|
16 | 19 | - [System limit for number of file watchers reached](#system-limit-for-number-of-file-watchers-reached)
|
17 |
| -- [Contributing](#contributing) |
| 20 | +- [Credits](#credits) |
18 | 21 |
|
19 |
| -## Introduction |
| 22 | +## Overview |
20 | 23 |
|
21 | 24 | [Browsersync](https://browsersync.io/) is free software that features:
|
22 | 25 |
|
|
26 | 29 |
|
27 | 30 | This add-on allows you to run [Browsersync](https://browsersync.io/) through the DDEV web service.
|
28 | 31 |
|
29 |
| -## Getting Started |
| 32 | +## Installation |
30 | 33 |
|
31 |
| -1. Install the DDEV Browsersync add-on: |
| 34 | +To install this add-on, run: |
32 | 35 |
|
33 |
| -```sh |
| 36 | +```bash |
34 | 37 | ddev add-on get ddev/ddev-browsersync
|
| 38 | +ddev restart |
35 | 39 | ```
|
36 | 40 |
|
37 |
| -For earlier versions of DDEV run |
| 41 | +After installation, make sure to commit the `.ddev` directory to version control. |
38 | 42 |
|
39 |
| -```sh |
40 |
| -ddev get ddev/ddev-browsersync |
41 |
| -``` |
| 43 | +## Usage |
42 | 44 |
|
43 |
| -1. Use the custom command, `ddev browsersync`, to start the watcher |
| 45 | +| Command | Description | |
| 46 | +| ------- | ----------- | |
| 47 | +| `ddev browsersync` | Start the watcher | |
| 48 | +| `ddev launch :3000` | Launch the Browsersync page | |
44 | 49 |
|
45 |
| -```shell |
| 50 | +Examples: |
| 51 | + |
| 52 | +```bash |
46 | 53 | $ ddev browsersync
|
47 |
| -Proxying browsersync on https://mysite.ddev.site:3000 |
| 54 | +Proxying Browsersync on https://mysite.ddev.site:3000 |
48 | 55 | [Browsersync] Proxying: http://localhost
|
49 | 56 | [Browsersync] Watching files...
|
50 |
| -``` |
51 |
| - |
52 |
| -1. Launch the Browsersync page, via the `Proxying browsersync` URL shown in your terminal or `ddev launch :3000` |
53 | 57 |
|
54 |
| -```shell |
55 |
| -ddev launch :3000 |
| 58 | +$ ddev launch :3000 |
| 59 | +# The site should briefly display "Browsersync: connect" |
| 60 | +# in the top right corner, confirming it is connect to the server. |
56 | 61 | ```
|
57 | 62 |
|
58 |
| -The site should briefly display "Browsersync: connect" in the top right corner, confirming it is connect to the server. |
59 |
| - |
60 | 63 | ### Auto-start the watcher server
|
61 | 64 |
|
62 | 65 | You can use DDEV's `post-start` hook to start the watcher server and launch the page when DDEV starts.
|
63 | 66 |
|
64 |
| -1. Create a `.ddev/config.browsersync-extras.yaml` |
65 |
| - |
66 |
| -```yml |
| 67 | +```bash |
| 68 | +cat <<'EOF' > .ddev/config.browsersync-extras.yaml |
67 | 69 | hooks:
|
68 |
| - post-start: |
69 |
| - - exec-host: bash -c "ddev browsersync &" |
70 |
| - - exec-host: ddev launch :3000 |
71 |
| -``` |
72 |
| -
|
73 |
| -1. Restart DDEV to apply the changes. |
| 70 | + post-start: |
| 71 | + - exec-host: bash -c "ddev browsersync &" |
| 72 | + - exec-host: ddev launch :3000 |
| 73 | +EOF |
74 | 74 |
|
75 |
| -```shell |
76 | 75 | ddev restart
|
77 | 76 | ```
|
78 | 77 |
|
@@ -211,8 +210,8 @@ You either have to decrease the number of files you’re watching or increase th
|
211 | 210 |
|
212 | 211 | - On Linux, you can change `fs.inotify.max_user_watches` on the host in `/etc/sysctl.d/local.conf` or elsewhere.
|
213 | 212 |
|
214 |
| -## Contributing |
| 213 | +## Credits |
215 | 214 |
|
216 | 215 | PRs for install steps for specific frameworks are welcome.
|
217 | 216 |
|
218 |
| -**Contributed and maintained by [tyler36](https://github.com/tyler36)** |
| 217 | +**Contributed and maintained by [@tyler36](https://github.com/tyler36)** |
0 commit comments