File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
test/fixtures/templates-4/b Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change 11import { resolve , dirname } from "path"
22import { readdir , readFile , lstat } from "fs/promises"
33
4- const reInclude = new RegExp ( '{%\\s+include\\s+("|\')(\\./\\S+?)\\1\\s+%}' , 'g' )
4+ const reInclude = new RegExp ( '{%-? \\s+include\\s+("|\')(\\./\\S+?)\\1\\s+-? %}' , 'g' )
55
66
77/**
@@ -33,7 +33,7 @@ export async function resolveTemplates (folder) {
3333 const found = content . match ( reInclude )
3434 if ( found ) {
3535 found . forEach ( str => {
36- const name = str . replace ( / ^ { % \s + i n c l u d e \s + ( " | ' ) / , '' ) . replace ( / ( " | ' ) \s + % } $ / , '' )
36+ const name = str . replace ( / ^ { % - ? \s + i n c l u d e \s + ( " | ' ) / , '' ) . replace ( / ( " | ' ) \s + - ? % } $ / , '' )
3737 content = content . replace ( str , resolveIncludes ( resolve ( dirname ( filepath ) , name ) ) )
3838 } )
3939 }
Original file line number Diff line number Diff line change 22
33{% include "./c/c.j2" %}
44
5- {% include "./_d.j2" %}
5+ {% - include "./_d.j2" - %}
You can’t perform that action at this time.
0 commit comments