title: How to load CSS from library when using 'require'
body: <p>I’m building an <a href="https://github.com/atom/electron" rel="nofollow noreferrer"><code>electron</code></a> app. In it, I have a <a href="https://github.com/atom/electron/blob/29052b04986daf55ecda4163bb94adaf522d1a10/docs/api/web-view-tag.md" rel="nofollow noreferrer"><code>webview</code></a> with a <a href="https://github.com/atom/electron/blob/29052b04986daf55ecda4163bb94adaf522d1a10/docs/api/web-view-tag.md#preload" rel="nofollow noreferrer"><code>preload</code> script</a>. Inside said script, I’d like to use <a href="https://github.com/t4t5/sweetalert" rel="nofollow noreferrer"><code>sweetalert</code></a>.</p>
  
  <p>I installed <code>sweetalert</code> with <code>npm install --save sweetalert</code>. Inside my script I load it with <code>require('sweetalert')</code> and call it with <code>swal("Hello world!");</code>. I now notice it doesn’t look right, as the alert is missing its <a href="https://github.com/t4t5/sweetalert/tree/3b9d8eb90268e0b1f8f58b2eba240631df0ad18f#usage" rel="nofollow noreferrer">required CSS file</a>. But I’m loading it with <code>require('sweetalert')</code>, which is great since <code>sweetalert</code> can just remain in its directory inside <code>node_modules</code> and I don’t have to care for it, but its CSS is an integral part of it, and is not getting pulled the same way.</p>
  
  <p>Now, what is the recommended way of solving this? Keep in mind I’m inside a <code>javascript</code> file and would like to remain that way. Do I really have to go get the CSS file and <a href="https://stackoverflow.com/a/577002/1661012">inject it</a> in some way? And how would I do it correctly, since it is inside <code>node_modules</code>? After testing it, it seems like it can’t be done in this particular case due to <a href="https://en.wikipedia.org/wiki/Content_Security_Policy" rel="nofollow noreferrer">Content Security Policy</a>.</p>
  
  <p>Either way, that seems so clunky in comparison to the <code>require</code> statement, it’d seem weird for a simpler solution to not be available.</p>