• Robert Knight's avatar
    Fix KaTeX font loading · e3384922
    Robert Knight authored
    When rendering math, the custom KaTex fonts failed to load due to the
    relative URL references in `build/styles/katex.min.css` not matching the
    actual location of the fonts in `build/fonts`. The KaTeX CSS assumes a
    URL structure like:
    
    ```
    katex.min.css
    fonts/
      KaTeX_AMS-Regular.woff2
    ```
    
    Previously font URLs in katex.min.css were rewritten from
    `url('fonts/foo.woff2')` to `url('../fonts/foo.woff2')` by a PostCSS
    plugin when building the CSS bundles. However this got lost when
    replacing the client's local style-bundling script with the one from the
    @hypothesis/frontend-shared package.
    
    By relocating the fonts to a subdirectory of `build/styles` we can make
    the asset references work without needing to do any rewriting of URLs in
    the KaTeX CSS bundle.
    
    In the process, the list of fonts included in the bundle was simplified
    to include just WOFF2 fonts, since all modern browsers support that
    format. Additionally an obsolete reference to fonts in src/styles/vendor
    was removed.
    e3384922
gulpfile.mjs 5.65 KB