electron-pug

2.0.0 • Public • Published

electron pug

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.

Neutron Compatible NPM Version license

Installation

npm install electron-pug

Usage

Just initialize this module with desired options for Pug package and your locals:

'use strict';
 
const {app, BrowserWindow} = require('electron')
const locals = {/* ...*/}
const setupPug = require('electron-pug')
 
// Standard stuff
 
app.on('ready', async () => {
  try {
    let pug = await setupPug({pretty: true}, locals)
    pug.on('error', err => console.error('electron-pug error', err))
  } catch (err) {
    // Could not initiate 'electron-pug'
  }
 
  let mainWindow = new BrowserWindow({ width: 800, height: 600 })
 
  mainWindow.loadURL(`file://${__dirname}/index.pug`)
  // the rest...
})

Endorsements

Here is a list of all projects (known to me) who have silently endorsed this project (or its predecessor) by copying the source code without attribution: yet-another-electron-pug, electron-nunjucks, wfo-app, demetra-aplikacija, electron-twig, FreeFrontiers-App, electron-posthtml, and many other that I failed to track down!

Even more!

If you want to have least effort when developing electron packages, take a look at neutron!

Readme

Keywords

Package Sidebar

Install

npm i electron-pug

Weekly Downloads

10

Version

2.0.0

License

MIT

Unpacked Size

6.85 kB

Total Files

6

Last publish

Collaborators

  • yan-foto