GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.33k stars 632 forks source link

Add ability to change .html extension for FallbackServer #1032

Closed jimmymcpeter closed 1 month ago

jimmymcpeter commented 2 months ago

Is your feature request related to a problem? Please describe. I am working with a site that uses .htm instead of .html for its file extension. The FallbackServer class only looks for .html files according to the following line -- https://github.com/GoogleChrome/lighthouse-ci/blob/19c7ca669fcb50c28de977dfdeefe3d4c43b014b/packages/cli/src/collect/fallback-server.js#L105

Describe the solution you'd like It'd be nice to be able to change the .html extension to .htm using a config parameter. Maybe even send an array of extensions.

Describe alternatives you've considered Renaming all files to .html unfortunately breaks existing hyperlinks. Currently I have a script that overrides the FallbackServer class code from const htmlFiles = files.filter(file => file.endsWith('.html')).map(file => ({file, depth: 0})); to const htmlFiles = files.filter(file => file.endsWith('.htm')).map(file => ({file, depth: 0}));

Additional context Documentation sites built using MadCap Flare almost always use the .htm extension.