jmjuanes / electron-ejs Goto Github PK
View Code? Open in Web Editor NEWSimple Electron plugin for rendering EJS templates
Home Page: https://www.npmjs.com/package/electron-ejs
License: MIT License
Simple Electron plugin for rendering EJS templates
Home Page: https://www.npmjs.com/package/electron-ejs
License: MIT License
Hi all. I have a .ejs
file look like this
<%- include('user.header'); -%>
<h1>
Title
</h1>
<p>
My page
</p>
<%- include('user.footer'); -%>
after running the app I am getting error look like this
Could not find the include file "user.header" at getIncludePath (/var/www/desktop-electron/node_modules/ejs/lib/ejs.js:162:13)
In my main.js
I have a code look like this
function showTemplate(template) {
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, APP.TemplatesPath, template),
protocol: 'file:',
slashes: true
}));
}
showTemplate('user.dashboard.ejs')l
Your package have conflict with win.webContents.openDevTools() function I had big headache with that until I get that it's because of module,when I make it comment there is no error, but when I try to run app with both it gives error with code ENNOENT and can't find a lot of files.
The options listed in ejs website: EJS options section
I am loading the relative path in the app this way
// load the app first page
const url = `file://${__dirname}/../views/pages/mapping.ejs`
win.loadURL(url)
Without partials it works fine, with partials in the EJS script, File Not Found
exceptions are thrown and bubble up the app. I have tried passing the relative directory into the EJS scripts and loading the partials that way with no luck.
After including electron-ejs
, is there a command to run the transform on all ejs
files?
[0] /Users/aarav/Downloads/codingshit/ACROMAXX/node_modules/.pnpm/[email protected]/node_modules/electron-ejs/index.js:30
[0] app.on("ready", function () {
[0] ^
[0]
[0] TypeError: Cannot read properties of undefined (reading 'on')
[0] at new ElectronEjs (/Users/aarav/Downloads/codingshit/ACROMAXX/node_modules/.pnpm/[email protected]/node_modules/electron-ejs/index.js:30:9)
[0] at file:///Users/aarav/Downloads/codingshit/ACROMAXX/src/index.js:23:11
this has been happening with alot of electron packages recently, idk why, ive been trying to fix this for so long, no luck.
Hi all. I am trying to pass data to inluced ejs tempalte.So in my main.js
I have a code look like this
sendPostRequest('GET', 'user/get_accounts', {}, function (res) {
res = JSON.parse(res);
if (res.status === true) {
var accounts = res.result.accounts;
var currencies = res.result.currencies;
var ejs = new electronEjs({accounts:accounts,currencies:currencies,a:'A'});
showTemplate(APP.Templates.Account);
}
}, true);
function showTemplate(template) {
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, APP.TemplatesPath, template),
protocol: 'file:',
slashes: true
}));
}
But after running app I am getting an error look like this
Uncaught Exception:
ReferenceError: /var/www/desktop-electron/templates/user/accounts.ejs:2
1| <%- include('header'); -%>
>> 2| <p><%= a %></p>
3| <%- include('footer'); -%>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.