Skip to content

Commit 5d33f24

Browse files
author
ZackHawkinsMC
committed
fix(engine_twig_php): Twig incremental rebuilds
Fixes issue where programmatically created twig includes would throw a warning at compile time. Closes issue #1015
1 parent 1ade945 commit 5d33f24

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/engine-twig-php/lib/engine_twig_php.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ const engine_twig_php = {
135135
// %}
136136
findPartials: function(pattern) {
137137
const matches = pattern.template.match(this.findPartialsRE);
138-
return matches;
138+
const filteredMatches =
139+
matches &&
140+
matches.filter(match => {
141+
// Filter out programmatically created includes.
142+
// i.e. {% include '@namespace/icons/assets/' ~ name ~ '.svg' %}
143+
return match.indexOf('~') === -1;
144+
});
145+
return filteredMatches;
139146
},
140147

141148
findPartialsWithStyleModifiers(pattern) {

0 commit comments

Comments
 (0)