Closed jacksleight closed 1 year ago
ServiceProvider::boot()
.src/resources/server.php
). This allows us to emulate Apache's mod_rewrite functionality from within this simple HTTP server and provides an easy way of testing our application without having installed any other real web servers here locally or elsewhere where we might be deploying it later on down the road when using Statamic as a headless CMS solution instead of just running it like you would normally do if you were building your own custom Laravel app from scratch yourself manually step by step one line at time starting out with something like:Rad! I had wanted to do this for a while. I actually find myself running ssg:serve
thinking it already existed.
Shame we need to reinvent the command. It would be neat if you artisan serve
could be given a directory. Oh well.
Yeah that was my first thought too! I did consider extending the Laravel command and just overriding the startProcess
method, but that felt a bit untidy. And the Laravel command is doing a bunch of stuff that's not really needed here.
Don't suppose this could be released?
Whoops, sorry 😬 Tagged now.
When developing locally it can be useful to test out the SSG and its generated output, but you can't just open the site up in a browser as all the links and asset URLs are absolute and have to point to a real host.
This PR adds an
ssg:serve
command that launches the PHP dev server in the SSG destination folder.The way I'm using this is by creating a
.env.serve
file:Then running:
The command itself is just a stripped down and tweaked version of Laravel's serve command.