I am writing a chrome extension, utilising content scripts and injecting HTML into a page. The HTML I plan to inject will be reasonably complex so I would prefer to write the HTML directly, rather than designing the nodes in JavaScript. I would like to have the HTML in a separate file in my chrome extension, and, using the content script, inject the contents of that file into a webpage.
I am quite new to JavaScript, but have become familiar with selecting, editing, deleting and adding HTML with the language, but I don't know how to access other files in JavaScript. I know it's basically impossible to access local file on the users machine, but I'm talking a file packaged in the chrome extension.
I know it is possible to inject a string in the HTML, but I would rather not write all my HTML into a single sting in JavaScript.
How can I access a file packaged in a chrome extension with JavaScript?