Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmjuanes/electron-ejs
Simple Electron plugin for rendering EJS templates
https://github.com/jmjuanes/electron-ejs
ejs electron electron-ejs electron-plugin
Last synced: 3 months ago
JSON representation
Simple Electron plugin for rendering EJS templates
- Host: GitHub
- URL: https://github.com/jmjuanes/electron-ejs
- Owner: jmjuanes
- License: mit
- Created: 2015-11-25T12:01:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-23T13:29:41.000Z (about 4 years ago)
- Last Synced: 2024-03-14T21:06:46.988Z (10 months ago)
- Topics: ejs, electron, electron-ejs, electron-plugin
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/electron-ejs
- Size: 27.3 KB
- Stars: 13
- Watchers: 4
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electron-ejs
[![npm](https://img.shields.io/npm/v/electron-ejs.svg?style=flat-square)](https://www.npmjs.com/package/electron-ejs)
[![npm](https://img.shields.io/npm/dt/electron-ejs.svg?style=flat-square)](https://www.npmjs.com/package/electron-ejs)
[![npm](https://img.shields.io/npm/l/electron-ejs.svg?style=flat-square)](https://github.com/jmjuanes/electron-ejs)Simple Electron plugin for rendering EJS templates. It allows you to use `ejs` files in your electron projects.
## Install
Install **electron-ejs** using NPM:
```
npm install electron-ejs
```## Usage
```javascript
//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");
});
```## API
### electronEjs(data, options)
Initializes the `electron-ejs` parser. This can take the following arguments:
#### data
An object with the data that will be used as a variable in your `ejs` file.
#### options
An object with the `ejs` options. The list with all the options are available here: [https://github.com/mde/ejs#options](https://github.com/mde/ejs#options).
The `filename` options is not necessary and will be ignored.
## Want to contribute?
Pull requests and issues are always welcome :)
## Contributors
See the [full list](https://github.com/jmjuanes/electron-ejs/graphs/contributors) of contributors.
## License
[MIT](LICENSE) © Josemi Juanes.