Skip to content

Commit

Permalink
feat: add cleanUrls configuration option to serve command
Browse files Browse the repository at this point in the history
  • Loading branch information
ZumiFlores committed Oct 3, 2024
1 parent 0794ebd commit 99208cb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/docusaurus/src/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {loadSiteConfig} from '../server/config';
import {build} from './build';
import {getHostPort, type HostPortOptions} from '../server/getHostPort';
import type {LoadContextParams} from '../server/site';
import { Command } from 'commander';

function redirect(res: http.ServerResponse, location: string) {
res.writeHead(302, {
Expand All @@ -36,6 +37,14 @@ export async function serve(
siteDirParam: string = '.',
cliOptions: Partial<ServeCLIOptions> = {},
): Promise<void> {
const program = new Command();

program
.option('--no-clean-urls', 'Disable clean URLs (keep .html extensions)')
.parse(process.argv);

const { noCleanUrls } = program.opts();

const siteDir = await fs.realpath(siteDirParam);

const buildDir = cliOptions.dir ?? DEFAULT_BUILD_DIR_NAME;
Expand Down

0 comments on commit 99208cb

Please sign in to comment.