Skip to content

Commit

Permalink
wip - need PHP installed locally part of #554
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer authored and geoffp committed Feb 23, 2018
1 parent 642eae7 commit 4c8572e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions packages/patternengine-node-twig/lib/engine_twig.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

const fs = require('fs-extra');
const path = require('path');
const Twig = require('twig');
const twig = Twig.twig;
const process = require('process');
const Twig = require('node-twig');
const twig = Twig.renderFile;

var engine_twig = {
engine: Twig,
Expand All @@ -40,11 +41,19 @@ var engine_twig = {

// render it
renderPattern: function renderPattern(pattern, data) {
var result = twig({
data: pattern.extendedTemplate
}).render(data);

return result;
console.log(path.resolve(process.cwd(), pattern.relPath))

twig(pattern.relPath, {
root: process.cwd(),
context: data
}, (error, template) => {
if (error) {
console.log(error);
}
console.log(template);
return template;
});
},

// find and return any {% include 'template-name' %} within pattern
Expand Down
2 changes: 1 addition & 1 deletion packages/patternengine-node-twig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "lib/engine_twig.js",
"dependencies": {
"fs-extra": "^0.30.0",
"twig": "^0.9.5"
"node-twig": "^1.1.0"
},
"devDependencies": {},
"keywords": [
Expand Down

0 comments on commit 4c8572e

Please sign in to comment.