abhijithvijayan / web-extension-starter

🖥🔋Web Extension starter to build "Write Once Run on Any Browser" extension
MIT License
2.03k stars 172 forks source link

Add support for content scripts #12

Closed abhijithvijayan closed 5 years ago

abhijithvijayan commented 5 years ago

Feature Request

jgornick commented 5 years ago

Great project!

I was wondering if this is something that can be done manually without having to implement a templated solution? I'm looking to support content scripts so that I can inject a script into a page.

Any help would be greatly appreciated!

Thanks!

abhijithvijayan commented 5 years ago

Let me look onto that

jgornick commented 5 years ago

I suppose one could inject programmatically: https://developer.chrome.com/extensions/content_scripts#programmatic

abhijithvijayan commented 5 years ago

I guess, adding an entry to webpack config file and then updating the manifest file would do it nice and smooth.

"content_scripts": [ { "matches": ["http://*.nytimes.com/*"], "css": ["myStyles.css"], "js": ["contentScript.js"] } ],
jgornick commented 5 years ago

I'll keep you posted. It's getting late here, so might have to dive in tomorrow. Thank you so much!

abhijithvijayan commented 5 years ago

I will try to add a demo with content scripts.

Edit: See this demo: https://github.com/abhijithvijayan/nice-try-scribd

abhijithvijayan commented 5 years ago

I just added a sample content script file to this starter as well.

jgornick commented 5 years ago

Awesome! Works @abhijithvijayan, thank you!

abhijithvijayan commented 5 years ago

@jgornick Good to hear. :smiley: