Skip to content

Commit 5487064

Browse files
committed
Improved @{import}.
1 parent 69541a0 commit 5487064

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

internal.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,10 +1997,25 @@ function view_parse(content, minify, filename, controller) {
19971997

19981998
for (var a = 0, al = RENDERNOW.length; a < al; a++) {
19991999
if (tmp.startsWith(RENDERNOW[a])) {
2000-
if (tmp.indexOf('\'meta\'') !== -1 || tmp.indexOf('\'head\'') !== -1)
2001-
break;
2002-
if (tmp.indexOf('+') === -1)
2003-
can = true;
2000+
2001+
if (tmp.indexOf('+') !== -1)
2002+
continue;
2003+
2004+
if (!a) {
2005+
var isMeta = tmp.indexOf('\'meta\'') !== -1;
2006+
var isHead = tmp.indexOf('\'head\'') !== -1;
2007+
tmp = tmp.replace(/\'(meta|head)\'\,/g, '').replace(/(\,\,|\,\)|\s{1,})/g, '');
2008+
if (isMeta || isHead) {
2009+
var tmpimp = '';
2010+
if (isMeta)
2011+
tmpimp += (isMeta ? '\'meta\'' : '');
2012+
if (isHead)
2013+
tmpimp += (tmpimp ? ',' : '') + (isHead ? '\'head\'' : '');
2014+
builder += '+self.$import(' + tmpimp + ')';
2015+
}
2016+
}
2017+
2018+
can = true;
20042019
break;
20052020
}
20062021
}

test/views/fromURL.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@{config.name}

0 commit comments

Comments
 (0)