Skip to content

Add --enable-external-stylesheets option to serve #23

Description

@karlgong-ef

Feature request

Expose the browser binary's --enable-external-stylesheets flag as an option on lightpanda.serve().

Context

The Lightpanda binary supports --enable-external-stylesheets as a common option of the serve subcommand (from lightpanda serve --help):

--enable-external-stylesheets
        Fetch external <link rel=stylesheet> resources so their rules
        contribute to computed styles (and therefore to visibility checks like
        display, visibility, opacity, pointer-events).

However, LightpandaServeOptions currently only supports host, port, disableHostVerification, obeyRobots, and httpProxy, so there is no way to pass this flag when starting the CDP server through the npm package.

This matters for Playwright/CDP-based test automation: without external stylesheets, visibility checks (display, visibility, opacity, pointer-events) can produce different results than a regular browser, since rules from <link rel=stylesheet> never contribute to computed styles.

Proposed change

Add an enableExternalStylesheets?: boolean option to LightpandaServeOptions, mapped to the --enable-external-stylesheets flag (flag-only, same as obeyRobots--obey-robots):

export type LightpandaServeOptions = {
  host?: string;
  port?: number;
  disableHostVerification?: boolean;
  obeyRobots?: boolean;
  httpProxy?: string;
  enableExternalStylesheets?: boolean;
};

This follows the same pattern as #5 (--obey-robots) and #9 (--dump markdown).

Happy to open a PR if this sounds good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions