mattdesl / budo

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

Specifying your file name after the `--live` flag seems to prevent browserify from running #214

Closed chinedufn closed 6 years ago

chinedufn commented 7 years ago

So I started reading through the code to see what might be going on here, but figured I'd step back and open an issue in case you already had an idea.

Here's a screenshot showing my attempts to set --live followed by my filename:

image

So it seems like specifying the filename after --live prevents the tutorial.js (filename) argument from being parsed. If I'm reading the docs correctly it looks like --live doesn't accept any arguments so this seems like undesired behavior.


I actually ran into this months ago but never thought to change the order of my arguments :( . Came back today and accidentally changed my order and was like woah why does this work now?

I'm happy to dig into what's going on if you don't already know what might be causing this!

mattdesl commented 7 years ago

Yeah, this is unfortunate and not something I had considered. But --live at one point was a boolean, and more recently it accepts a string like --live=*.{html,css} to filter some file types (mainly added to make HMR easier to work with). There doesn't seem to be an easy way to detect whether --live foo/bar.js is desired as a bundler path, or as a filename filter. :(

Something that might help is: if --live foo is specified but no entry file exists, budo could print a warning about this edge case and suggest to re-order parameters. This will add additional spam to users who are legitimately trying to run budo without an entry file and with a --live filter, but that is probably a very small use case.

chinedufn commented 7 years ago

Ah thank you very much for breaking that down. Tricky tricky indeed.

Idea Part 1:

Maybe the easiest thing we can do here is update the usage docs to make it slightly more clear that --live takes options?

image

An idea:

# before
--live, -l       enable default LiveReload integration.
# after
--live, -l       enable default LiveReload integration on file globs. Defaults to '**/*'

Idea part 2

When you run budo you already get a log that live reload is running:

image

LiveReload running on 35730

Maybe we can change this to say

LiveReload running on 35730 for files matching 'tutorial.js'

The goal here would be to make past @chinedufn go "Um why is it only live reloading tutorial.js? Ohhhh it takes options. DOH!"


And haha I definitely realize that I'm maybe 1 of some small number people who have ever run into this.. but would still love to cover up my tracks here!

mattdesl commented 6 years ago

In 11.1.3 there is now a warning when you use the wrong order:

Also any time you specify a --live file name filter glob, it will print the glob below the live reload connection event.

Thanks for your feedback and sorry it took so long — little things like this make the tool much easier for newcomers. :smile:

screen shot 2018-02-13 at 10 54 12 pm
chinedufn commented 6 years ago

🎉 thanks!