Created
December 20, 2017 17:24
-
-
Save grimmdev/2f1ea60310d691c8668fe0a0313db0d2 to your computer and use it in GitHub Desktop.
Electron and PUG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Was able to piece the solution together using several answers from separate topics. | |
// Pretty simple function, passes in the window you want to use pug files and renders it | |
function RenderPUG(win, page) | |
{ | |
let h = 'data:text/html;charset=utf-8,' + encodeURI(pug.renderFile(page)) | |
win.loadURL(h) | |
} | |
// Example RenderPUG(mainWindow, 'views/index.pug') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Souldn't it actually be
encodeURIComponent
?encodeURI
does not cover everything: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent