Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to suppress 'Missing font type mapping' warnings #6

Closed
kripod opened this issue Sep 10, 2023 · 1 comment
Closed

Add option to suppress 'Missing font type mapping' warnings #6

kripod opened this issue Sep 10, 2023 · 1 comment

Comments

@kripod
Copy link

kripod commented Sep 10, 2023

While trying to integrate this plugin in an Astro project, the parameter provided by srcUrlToFilename couldn’t be used, as sometimes, the url has a format similar to .__VITE_ASSET__abcd1234__.

In order to mitigate the issue, I came up with the idea of including the plugin twice and returning a static path via srcUrlToFilename. However, the following postcss.config.cjs produces unwanted 'Missing font type mapping' warnings as a result:

const postcssFontpie = require("postcss-fontpie");

const atkinsonHyperlegibleFilename = require.resolve(
  "@fontsource/atkinson-hyperlegible/files/atkinson-hyperlegible-latin-400-normal.woff2",
);
const jetBrainsMonoFilename = require.resolve(
  "@fontsource/jetbrains-mono/files/jetbrains-mono-latin-400-normal.woff2",
);

module.exports = {
  plugins: [
    postcssFontpie({
      fontTypes: { "Atkinson Hyperlegible": "sans-serif" },
      srcUrlToFilename: () => atkinsonHyperlegibleFilename,
    }),
    postcssFontpie({
      fontTypes: { "JetBrains Mono": "mono" },
      srcUrlToFilename: () => jetBrainsMonoFilename,
    }),
  ],
};

I’d propose an option to suppress such warnings as a mitigation.

@TomerAberbach
Copy link
Owner

Gonna implement #7 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants