From 1fd606031d018854d2b8d08d30863105567fcccc Mon Sep 17 00:00:00 2001 From: Norberto Lopes Date: Fri, 4 Aug 2023 17:00:11 +0100 Subject: Add pretty urls This adds a new flag namely `--pretty-urls` that when enabled will serve the equivalent `.html` if it exists. Very much the same approach that [`netlify` uses](https://docs.netlify.com/site-deploys/post-processing/). It can be quite useful when having hrefs like `/about` serve `/about.html`. --- src/args.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/args.rs') diff --git a/src/args.rs b/src/args.rs index f7b42f1..590ac14 100644 --- a/src/args.rs +++ b/src/args.rs @@ -41,6 +41,14 @@ pub struct CliArgs { #[arg(long, requires = "index", env = "MINISERVE_SPA")] pub spa: bool, + /// Activate Pretty URLs mode + /// + /// This will cause the server to serve the equivalent `.html` file indicated by the path. + /// + /// `/about` will try to find `about.html` and serve it. + #[arg(long, env = "MINISERVE_PRETTY_URLS")] + pub pretty_urls: bool, + /// Port to use #[arg( short = 'p', -- cgit v1.2.3