Skip to content

Strip down bundled Maplibre CSS #7544

Open

Description

@emilykl

#7526 inlines the entire maplibre-gl.css stylesheet into the Plotly.js bundle, to fix the styling of attributions in MapLibre.

This works, but also adds about 45 kB to the bundle size. Plausibly we could slim down the CSS and include only the styles we definitely need.

This file (4 kB) is enough to fix the attribution styling:

maplibre-gl-attrib.css

However this will require adding a script to parse and subset the CSS which runs as part of the build process.

Activity

  1. added
    P2considered for next cycle
    on Sep 9, 2025
  2. jendrikw commented on Sep 18, 2025

    @jendrikw

    I use plotly in a vite-bundled website like so:

    import Plotly from "plotly.js/lib/core.js";
    import scatter from "plotly.js/lib/scatter";
    import table from "plotly.js/lib/table";
    
    Plotly.register([scatter, table]);

    As you can see, I'm not using any map functionality, but I can see the maplibre css in my bundle. Is there any way of excluding this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cyclefeaturesomething new

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions