mattdesl / budo

:clapper: a dev server for rapid prototyping
MIT License
2.18k stars 106 forks source link

--live for css only? (When using browserify-hmr) #212

Closed spacejack closed 7 years ago

spacejack commented 7 years ago

I'm using browserify-hmr, so I can't use the --live flag. However I won't get CSS reloads this way.

My workaround to use the --live flag is to provide budo an empty JS script, then start a separate watchify script for browserify-hmr. Point budo at the directory to serve. This way I get HMR for code updates and budo does CSS updates. But I lose the benefit of using budo as my browserify/watchify command.

So this is what I'm using for now:

"watch": "watchify -v --debug src/index.ts -p [ browserify-hmr ] -p [ tsify --project src/tsconfig.json ] -o public/js/app.js",
"serve": "budo scripts/dummy.js -p 3000 --dir public --live",
"start": "npm-run-all -p watch serve"
mattdesl commented 7 years ago

The --live flag supports a file glob exactly for this purpose. :smile: The following will ignore reload events on your JS bundle:

budo scripts/dummy.js -p 3000 --dir public --live=*.{html,css}

You can also run your own dev.js script if you want more control over how LiveReload is set up. You can read more about LiveReload here: https://github.com/mattdesl/budo/blob/master/docs/live-reload.md

spacejack commented 7 years ago

Ah, you're right! Sorry, I must have messed up somewhere I thought it was reloading the page.

Anyway, excellent dev tool! 👍

spacejack commented 7 years ago

Come to think of it, I may have misinterpreted the section on HMR where it says

Make sure you don't pass a --live flag to budo, otherwise it will trigger hard reloads on file save.

But I guess that applies to livereactload only.

mattdesl commented 7 years ago

I should probably update that to make this feature clearer. :smile: