Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Templating in Electron?

Simple question here, but I found no useful resource. Is templating possible in Electron? Using Jade or Handlebars to display dynamic templates? I know there is .loadURL() that takes a static html file.

Is dynamic possible?

Thanks.

like image 498
Molnár Márk Avatar asked Jul 25 '16 16:07

Molnár Márk


2 Answers

You could give electron-pug a chance. https://github.com/yan-foto/electron-pug

like image 75
fabianmoronzirfas Avatar answered Oct 27 '22 15:10

fabianmoronzirfas


It would certainly be possible to use Jade or Handlebars for dynamic templating by running a local server in the Electron main process. I would not recommend this however, as it is kind of backwards. Electron is primarily a front end framework and while running a local server is good for some things, templating is not really one of them.

Most people use a frontend JS framework like Angular or React.

like image 29
Teak Avatar answered Oct 27 '22 16:10

Teak