electron-twig
v1.1.1
Published
Electron module to render Twig templates
Downloads
61
Readme
Electron Twig
Get Twig.js the JS implementation of the Twig Templating Language on electron projects.
This package is a simple file protocol interceptor
which compiles files with .twig
extension.
Installation
npm install electron-twig
Usage
const {app, BrowserWindow} = require('electron')
const twig = require('electron-twig')
app.on('ready', () => {
let win = new BrowserWindow({width: 800, height: 600})
win.loadURL(`file://${__dirname}/views/index.html.twig`)
// etc.
})
Put variables in template
const {app, BrowserWindow} = require('electron')
const twig = require('electron-twig')
app.on('ready', () => {
let win = new BrowserWindow({width: 800, height: 600})
win.loadURL(`file://${__dirname}/views/index.html.twig`)
twig.view = {
foo: 'bar'
}
// etc.
})