javascript - How to render Jade in Electron? -


in express possible set view engine jade following code:

app.set('view engine', 'jade'); 

so, allows express read , return compiled html jade files directly.

how can in electron?

i built small module intercept jade protocols , compile ending .jade , rest considered local files. use in main file following:

'use strict';  var app = require('app'); var locals = {/* ...*/}; var j = require('electron-jade')({pretty: true}, locals); var browserwindow = require('browser-window');  // standard stuff  app.on('ready', function () {   mainwindow = new browserwindow({ width: 800, height: 600 });    mainwindow.loadurl('jade://' + __dirname + '/index.jade');   // rest... }); 

note instead of file:// write jade://.

disclaimer: module in stages , logic still not mature enough.


update:

i published package on npm: https://www.npmjs.com/package/electron-jade


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -