I'm having trouble articulating what I want, but I'm sure this has been asked before. I'm looking for a way to use gulp to inject precompiled CSS into a javascript function that executions at runtime. Basically, something like this:
build/index.html
Contents:
<div> <!-- content here --></div>
build/index.css
Contents:
div {
background:red;
}
/* more rules */
Compiles to something like this:
dist/index.html
Contents:
<script>(function(){
var style=document.createElement('style');
style.innerHTML='div{background:red;} /* all the other rules */';
document.head.appendChild(style);
}());</script>
<div></div>
It doesn't have to resemble this exactly, but I hope my meaning is clear. I'm looking for away to avoid the work of converting my css into an inline string capable of being injected into the head at runtime by js.
Is this clear? Do you know of anything that assists in this process?
