I’m guessing the answer is “generate the CSS using a watcher process and link to it directly in your main window’s HTML”. Or possibly "link to less.js and include your *.less files as
<link rel="stylesheet">. But I thought I’d ask the experts here if there’s another way.
I’d prefer not to have a separate process from the Atom/browser process itself. I’d also prefer not to have to “compile” the LESS files every time I show a new window.
Is there some way to make the browser process generate the CSS from the LESS file and insert it into the page? I tried using
WebContents.insertCSS but could never get it to work. When is it safe to call that method? I called it just after a call to
loadUrl and then tried calling it from within a
did-finish-load event handler but neither worked nor produced an error.
I tried following what Atom itself is doing but got lost in the layers of abstraction. It looks like it’s relying on the Package lifecycle to insert the CSS via the template manager, or the less cache? My app is simpler so I was hoping my solution would be simple, too.