Simple Electron plugin for rendering EJS templates. It allows you to use ejs
files in your electron projects.
Install electron-ejs using NPM:
npm install electron-ejs
//Import dependencies
let electron = require("electron");
let electronEjs = require("electron-ejs");
//Initialize the app
let app = electron.app;
//Initialize the ejs parser
let ejs = new electronEjs({"key": "my value"}, {});
//Now you can read EJS files
app.on("ready", function () {
//Create the new window
mainWindow = new BrowserWindow({
"width": 800,
"height": 600
});
//More app configuration
// ....
//Load the ejs file
mainWindow.loadURL("file://" + __dirname + "/index.ejs");
});
Initializes the electron-ejs
parser. This can take the following arguments:
An object with the data that will be used as a variable in your ejs
file.
An object with the ejs
options. The list with all the options are available here: https://github.com/mde/ejs#options.
The filename
options is not necessary and will be ignored.
Pull requests and issues are always welcome :)
See the full list of contributors.
MIT © Josemi Juanes.