Comparing version 1.15.2 to 1.15.3
@@ -0,1 +1,7 @@ | ||
Version 1.15.3, released 2020-11-05 | ||
----------------------------------- | ||
Minor improvements: | ||
* Fix documentation of browser usage ([#755](https://github.com/twigjs/twig.js/pull/755)) by [odebparla](https://github.com/obedparla) | ||
* Add support for template arrays when using extends ([#754](https://github.com/twigjs/twig.js/pull/754)) by [justafish](https://github.com/justafish) | ||
Version 1.15.2, released 2020-08-19 | ||
@@ -2,0 +8,0 @@ ----------------------------------- |
@@ -5,3 +5,3 @@ { | ||
"description": "JS port of the Twig templating language.", | ||
"version": "1.15.2", | ||
"version": "1.15.3", | ||
"homepage": "https://github.com/twigjs/twig.js", | ||
@@ -8,0 +8,0 @@ "license": "BSD-2-Clause", |
@@ -44,3 +44,3 @@ [![Known Vulnerabilities](https://snyk.io/test/github/twigjs/twig.js/badge.svg)](https://snyk.io/test/github/twigjs/twig.js) | ||
```js | ||
var template = twig({ | ||
var template = Twig.twig({ | ||
data: 'The {{ baked_good }} is a lie.' | ||
@@ -47,0 +47,0 @@ }); |
@@ -712,3 +712,23 @@ // ## twig.logic.js | ||
.then(fileName => { | ||
state.template.parentTemplate = fileName; | ||
if (Array.isArray(fileName)) { | ||
const result = fileName.reverse().reduce((acc, file) => { | ||
try { | ||
return { | ||
render: state.template.importFile(file), | ||
fileName: file | ||
}; | ||
/* eslint-disable-next-line no-unused-vars */ | ||
} catch (error) { | ||
return acc; | ||
} | ||
}, { | ||
render: null, | ||
fileName: null | ||
}); | ||
if (result.fileName !== null) { | ||
state.template.parentTemplate = result.fileName; | ||
} | ||
} else { | ||
state.template.parentTemplate = fileName; | ||
} | ||
@@ -715,0 +735,0 @@ return { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1142898
14631