Skip to content

Commit 95dbea6

Browse files
authored
Updates README to include instructions on enabling BrowserSync
1 parent bbe1484 commit 95dbea6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,26 @@ volumes:
3636
- ./mysql:/var/lib/mysql
3737
```
3838

39+
## Using BrowserSync with Laravel Mix
40+
41+
If you want to enable the hot-reloading that comes with Laravel Mix's BrowserSync option, you'll have to follow a few small steps. First, ensure that you're using the updated `docker-compose.yml` with the `:3000` and `:3001` ports open on the npm service. Then, add the following to the end of your Laravel project's `webpack.mix.js` file:
42+
43+
```javascript
44+
.browserSync({
45+
proxy: 'nginx',
46+
open: false,
47+
port: 3000,
48+
});
49+
```
50+
51+
From your terminal window at the project root, run the following command to start watching for changes with the npm container and its mapped ports:
52+
53+
```bash
54+
docker-compose run --rm --service-ports npm run watch
55+
```
56+
57+
That should keep a small info pane open in your terminal (which you can exit with Ctrl + C). Visiting [localhost:3000](http://localhost:3000) in your browser should then load up your Laravel application with BrowserSync enabled and hot-reloading active.
58+
3959
## MailHog
4060

4161
The current version of Laravel (8 as of today) uses MailHog as the default application for testing email sending and general SMTP work during local development. Using the provided Docker Hub image, getting an instance set up and ready is simple and straight-forward. The service is included in the `docker-compose.yml` file, and spins up alongside the webserver and database services.

0 commit comments

Comments
 (0)