mattdesl / budo

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

Live reload without bundling? #245

Open spacejack opened 5 years ago

spacejack commented 5 years ago

I'm using this command:

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

CSS files are in public/css/ and JS files are in public/js/. The page itself is at public/index.html.

I see updates when edits are made to index.html and css files, but not for the JS files. Is there a way to get it to refresh the page when JS sources are changed?

Also, I'm using <script type="module" src="js/main.js"></script>. Although it doesn't seem to work with a plain old <script src="js/main.js"> either.

I also get the following warning which is a bit of an annoyance since it's not correct, but I can live with it...

NOTE: It looks like you are using budo without a JavaScript entry.
  This is fine, but if you were trying to bundle the "*.{html,js,css}" file,
  you should re-arrange your arguments like so:

      budo *.{html,js,css} --live
spacejack commented 5 years ago

Ugh, I did figure it out finally. It is a bit frustrating that the most obvious simple case is not very intuitive. I needed the command:

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

And the warning goes away as well.

Here's a sample project using this setup.

One strange thing is that the first edit I make to the JS file is not picked up. I have to shift-reload once, then after that budo's live reload seems to work from that point on.