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

Remove prefix in manifest file (manifest.webmanifest) #24

Open
jsonsivar opened this issue Feb 25, 2020 · 1 comment
Open

Remove prefix in manifest file (manifest.webmanifest) #24

jsonsivar opened this issue Feb 25, 2020 · 1 comment

Comments

@jsonsivar
Copy link

Currently the manifest file is not getting the prefix replaced. I think it's safe just to remove it since it's already relative. Looking at this line, it looks like if we add a special case for a .webmanifest file that removes it the URLs for the icons should be fine.

Let me know if that makes sense, I can try creating a PR for it if you think that's the right direction.

@jsonsivar
Copy link
Author

jsonsivar commented Feb 25, 2020

I added this snippet in a local project and it seemed to have cleared the manifest file:

exports.onPostBuild = async ({ reporter }) => {
    // replace prefix paths for manifest file   
    const path = 'public/manifest.webmanifest';
    const buffer = await readFileAsync(path);
    let contents = buffer.toString();

    if (!contents.includes('__GATSBY_IPFS_PATH_PREFIX__')) {
        return;
    }

    contents = contents
    .replace("\"/__GATSBY_IPFS_PATH_PREFIX__\"", "\"/\"")
    .replace(/\/__GATSBY_IPFS_PATH_PREFIX__\//g, "/");

    await writeFileAsync(path, contents);
}

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

1 participant