Skip to content

Instantly share code, notes, and snippets.

@shama
Created May 25, 2015 17:33
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shama/4d2760852cf8362ac15f to your computer and use it in GitHub Desktop.
Save shama/4d2760852cf8362ac15f to your computer and use it in GitHub Desktop.
Alternate way to load CSS file to ensure it gets loaded with a correct path with Electron
<html>
<head>
<title></title>
</head>
<body>
Hi
<script>
var link = document.createElement('link')
link.setAttribute('rel', 'stylesheet')
link.setAttribute('href', require('path').join(__dirname, 'css', 'app.css'))
document.head.appendChild(link)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment