Open andsouto opened 7 months ago
path
configuration is an absolute path to an icons directory. In that regard assets/icons
and /assets/icons
are equivalent.
You are right, I think I was mixing things...
But the problem is the generated manifest is always generated using an absolute path and there is no way to use a relative path. And a relative path makes sense as it is interpreted as relative to the manifest.webmanifest location. If the web app is deployed in a subpath and not in the / of an origin relative paths work but absolute paths don't. And if deployed in /
both work exactly the same way.
I'm fixing the problem doing this before writing the webmanifest to distk:
if (file.name === 'manifest.webmanifest') {
const contents = file.contents.replaceAll('/assets/icons/', 'assets/icons/');
return fs.writeFile(`${path}/${file.name}`, contents);
}
But I think it should be a cleaner way of doing this just by configuration.
Things are a bit backwards here. A Manifest file is secondary to icons. Historically the library was designed around icons and whatever else (e.g. manifests) were "extra files to generate".
I am using as configuration a relative value for path property:
But the generated
manifest.webmanifest
adds an initial/
. e.g.:Am I missing something or that
/
shouldn't be added? According to the specification if a relative path is used it is relative to the location of the webmanifest.