Skip to content

Instantly share code, notes, and snippets.

@rpayanm
Last active February 12, 2025 15:18
Show Gist options
  • Save rpayanm/e998e97e3ce3eadb9723c23f98d843ed to your computer and use it in GitHub Desktop.
Save rpayanm/e998e97e3ce3eadb9723c23f98d843ed to your computer and use it in GitHub Desktop.
```
npm i -D browser-sync concurrently
```
Copy as `browser-sync.js` in the theme root this code:
[browser-sync.js](https://cdn.cacher.io/attachments/u/3ago68caja1c5/bzFc4MHpo5m46G-cPn-bfU-ntMpELydY/browser-sync.js)
```js
const browserSync = require('browser-sync');
const siteUri = 'site.docksal.site'; // <--- Change this
browserSync({
proxy: siteUri,
host: siteUri,
open: 'external',
files: ['dist/js/**/*.js', 'dist/css/**/*.css'], // <--- Change this
});
```
Adjust the siteUri (no https or http), the css and js output folder.
Add in `package.json` in the script section:
```
"watch": "concurrently --kill-others \"script to watch\" \"node browser-sync.js\"" // <--- Change this
```
Change "script to watch".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment