Last active
February 12, 2025 15:18
-
-
Save rpayanm/e998e97e3ce3eadb9723c23f98d843ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
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