davorg-cpan / app-aphra

Static web site generator in Perl
3 stars 4 forks source link

Cleverer `serve` action #3

Open davorg opened 6 years ago

davorg commented 6 years ago

Currently, the serve action, runs build and then serves a static site. Can we monitor the input directories and rebuild the site if anything changes?

simbabque commented 5 years ago

I will have a look at this for the Pull Request Club. Do you mind adding extra dependencies?

davorg commented 5 years ago

Not at all. I'd prefer them to be optional, if possible. Perhaps it could revert to the current behaviour if they aren't available.

simbabque commented 5 years ago

You're saying that serve calls build, but I don't see that. It just gets App::HTTPThis to serve the directory.

davorg commented 5 years ago

It's possible I'm describing what should happen rather than what does happen :-/

Or, maybe, you've found a bug.

simbabque commented 5 years ago

I think no code whatsoever towards a feature doesn't technical count as a bug. ;)

I guess I found wishful thinking on your part. I'll add it in. Seems easy enough.

simbabque commented 5 years ago

Do you have a demo system for me to work with?

davorg commented 5 years ago

Yeah. https://github.com/davorg/whonews.tv is a web site that's built using Aphra.

simbabque commented 5 years ago

Thanks. I have looked at Filesys::Notify::Simple, which is what Plack::Runner/Plack::Loader uses to do reloads. I would prefer to actually use the Plack::Loader::Restarter directly instead of hacking forks into this thing, but App::HTTPThis does not support shoving in extra Plack bits as it brings its own runner that cannot easily be changed. I was thinking of patching a reload feature in, but @melo has removed the App::HTTPThis repository from his github account. I've contacted him to see what's going on there.