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

Importing images into the content script #183

Open
dpw1 opened this issue Aug 20, 2023 · 2 comments
Open

Importing images into the content script #183

dpw1 opened this issue Aug 20, 2023 · 2 comments

Comments

@dpw1
Copy link

dpw1 commented Aug 20, 2023

Hello,

Firstly thank you very much for the excellent work! Is there anyway I can import images into my content script? I have tried it like this:

import logo from '../../../assets/img/icon-128.png';

But it doesn't work. Any help is greatly appreciated. Thanks!

@thatBrian
Copy link

Did some soul searching and came up with this.

import icon from '../../../assets/test.jpg';
const container = document.createElement("div")
container.className = "charlie";
container.style.backgroundImage = `url('${chrome.runtime.getURL(icon)}')`;

But running into the issue with web_accessible_resources

@thatBrian
Copy link

Fixed the web_accessible_resource issue by updating the manifest.json file.
GoogleChrome/developer.chrome.com#544 (comment)

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