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

Missed dynamically execute scripts and inserts css #49

Open
ycherniavskyi opened this issue Jan 30, 2020 · 1 comment
Open

Missed dynamically execute scripts and inserts css #49

ycherniavskyi opened this issue Jan 30, 2020 · 1 comment

Comments

@ycherniavskyi
Copy link

My extension executes the content script and inserts its CSS dynamically (not with help of content_scripts section of manifest.json) from popup script with chrome.tabs.executeScript and chrome.tabs.insertCSS functions calls.

Is it possible to extend the functionality to catch extension files not only from manifest.json, or, in such case, I need to add them manually as parcel command parameter?

@emschwartz
Copy link

It seems like it works to do the following:

browser.contentScripts.register({
  js: [{ file: new URL("./path/to/file.js", import.meta.url).pathname.slice(1) }]
})

The import.meta.url is picked up by parcel so it resolves to the correct file. The .pathname.slice(1) is because the paths should be relative to the extension root.

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