The HTML in my app is the same regardless of window since I am using React components. To avoid a lot of dummy HTML files that are pretty much the same I have one that is dynamically told what component to load. The code in the HTML file looks a bit like:
let Component = require(`${__dirname}/../views/${view}`).default
let component = ReactDOM.render(<Component />, document.getElementsByTagName('body')[0])
This is working great except when it comes to stylesheets using Less. I can successfully hard-code a Less link and it compiles correctly. I can also dynamically include a link to a regular CSS file. But if I try to dynamically add a link to a less file it doesn't seem to load the CSS. How can I dynamically inject a Less stylesheet and have it pre-compile?
I did see this comment which indicates it is possible but that isn't the experience I get.
The HTML in my app is the same regardless of window since I am using React components. To avoid a lot of dummy HTML files that are pretty much the same I have one that is dynamically told what component to load. The code in the HTML file looks a bit like:
This is working great except when it comes to stylesheets using Less. I can successfully hard-code a Less
link
and it compiles correctly. I can also dynamically include alink
to a regular CSS file. But if I try to dynamically add alink
to aless
file it doesn't seem to load the CSS. How can I dynamically inject a Less stylesheet and have it pre-compile?I did see this comment which indicates it is possible but that isn't the experience I get.