I believe that your question has been answered satisfactorily. But, seeing how this question has several views, I decided that I would give people a little more information about this:
Particles (fragments, components, any) of the markup can be loaded into the electron from both angles; client and server sides.
on the client side
If you need to dynamically retrieve content based on user actions (for example, when you click a button).
This works the same in Electron as in any browser (except, of course, you have access to the file: protocol. You are using ajax. Or any library containing api loading (a friendly shell around ajax). So jQuery, angular, mithril etc. They will work.
Example:
$('#dynamic-content').load('file:///my-partial.html')
server side
If you want to use (not lazy-load, e.g. angular) modular HTML, with reusable components split into your own files.
Modular markup is a must for large applications. For this you will use some kind of template engine. AJS is a very popular and good choice for this.
For the server template, you have two options:
1) Pre-rendering
This may not be an option, depending on your use case. But if you know all the variables in advance, you can simply compile and display each recording file and save the results as html files.
An example of using ejs and the node fs module:
let template = fs.readFileSync('my-page.ejs') let compiled = ejs.render(tpl) fs.writeFileSync('my-page.html', compiled)
And then load the html file normally, for example:
myBrowserWindow.loadURL('file:///my-page.html')
2) Intercept the file: protocol.
This is the real deal. Electronic ships with a protocol module designed specifically for this. Here is an example of pseudocode with ejs:
Intercept all file requests. If the file is not a `.ejs` file, serve the file. If the file is a `.ejs` file, render it and serve the result.
And then you can load the ejs into your hearty content:
myBrowserWindow.loadURL('file:///my-page.ejs')
I will not include the full protocol interception code example here, since you probably will not implement it yourself. Instead, I would recommend using one of the many npm modules that will do this for you:
If you want to make a swing during its implementation, check out the Electron module documentation. Hooray!