My package includes an HTML file in a pane item via
iframe, and I would like to style elements within that
iframe according to the current Atom theme. The problem is:
I can style by linking to a CSS file within the HTML file, but that does not allow to use theme variables.
I can put a LESS file in the package’s
stylesdirectory so that it gets compiled, and I can use theme variables in it, but linking to that file within the HTML file doesn’t work.
I found that I can obtain the LESS-compiled-into-CSS by
css = document.querySelector( `style[source-path$="mypackage/styles/mystyle.less"]` ).innerText
and then inject it into the
myiframe.contentDocument.getElementById('dummystyle').innerText = css
dummystyle is the HTML ID of an empty
This works, but is rather hacky. Is there a better way?