File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,18 @@ export default function runTransformation(
64
64
if ( ! descriptor . template ) {
65
65
return source
66
66
}
67
+ let contentStart : number =
68
+ descriptor . template . ast . children [ 0 ] . loc . start . offset
69
+ let contentEnd : number =
70
+ descriptor . template . ast . children [
71
+ descriptor . template . ast . children . length - 1
72
+ ] . loc . end . offset + 1
73
+
74
+ fileInfo . source =
75
+ source . slice ( 0 , contentStart ) +
76
+ descriptor . template . content +
77
+ source . slice ( contentEnd , contentEnd + 11 )
67
78
68
- fileInfo . source = `<template>${ descriptor . template . content } </template>`
69
79
const out = transformation ( fileInfo , params )
70
80
71
81
if ( ! out ) {
@@ -78,7 +88,10 @@ export default function runTransformation(
78
88
return source // skipped, don't bother re-stringifying
79
89
}
80
90
// remove redundant <template> tag
81
- descriptor ! . template ! . content = out . slice ( 11 , - 11 )
91
+ descriptor ! . template ! . content = out . slice (
92
+ contentStart ,
93
+ descriptor . template . content . length - contentEnd
94
+ )
82
95
return stringifySFC ( descriptor ! )
83
96
}
84
97
You can’t perform that action at this time.
0 commit comments