This module is a simple file
protocol interceptor for electron which compiles all (local) URLs to files with .pug
extension (e.g /home/electron-pug/index.pug
) on the fly.
npm install electron-pug
Just initialize this module with desired options for Pug package and your locals:
'use strict';
const {app, BrowserWindow} = require('electron');
const locals = {/* ...*/};
const pug = require('electron-pug')({pretty: true}, locals);
// Standard stuff
app.on('ready', () => {
let mainWindow = new BrowserWindow({ width: 800, height: 600 });
mainWindow.loadUrl(`file://${__dirname}/index.pug`);
// the rest...
});
If you want to have least effort when developing electron packages, take a look at neutron!