Skip to content

[Bug]: Custom fonts with absolute src paths are not loaded due to incorrect path resolution #80

@hades343

Description

@hades343

Demo URL

No response

What happened?

There's an issue when using custom fonts with absolute src paths. The problem arises in the resolveFontFiles function, where the absolute root is joined with the absolute source, leading to incorrect path resolution. This prevents the plugin from loading custom fonts specified with absolute paths.

for (const source of sources) {
const results = fg.sync(join(root, source), { absolute: true, cwd: root, onlyFiles: true })

Reproduction steps

Unfonts({
  custom: {
    families: [
      {
        name: 'Geist',
        src: path.resolve(...),  // any absolute path
      },
    ],
    injectTo: 'head',
  },
});

Relevant log output

No error is thrown, the files are simply not found.

What browsers are you seeing the problem on?

Other

What is your operating system?

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions