File tree 3 files changed +20
-1
lines changed
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 6
6
p.pug-less
7
7
| This is rendered from < template lang="pug">
8
8
| and styled with < style lang="less"> . It should be green.
9
+ SlotComponent
10
+ template( v-slot:test-slot )
11
+ div.pug-slot slot content
9
12
</template >
10
13
14
+ <script setup>
15
+ function SlotComponent (_ , { slots }) {
16
+ return slots[' test-slot' ]()
17
+ }
18
+ </script >
19
+
11
20
<style lang="scss">
12
21
$color : magenta ;
13
22
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ describe('pre-processors', () => {
19
19
expect ( await page . textContent ( 'p.pug' ) ) . toMatch (
20
20
`This is rendered from <template lang="pug">`
21
21
)
22
+ // #1383 pug default doctype
23
+ expect ( await page . textContent ( '.pug-slot' ) ) . toMatch ( `slot content` )
22
24
editFile ( 'PreProcessors.vue' , ( code ) =>
23
25
code . replace ( 'Pre-Processors' , 'Updated' )
24
26
)
Original file line number Diff line number Diff line change @@ -133,6 +133,14 @@ export function resolveTemplateCompilerOptions(
133
133
transformAssetUrls = assetUrlOptions
134
134
}
135
135
136
+ let preprocessOptions = block . lang && options . template ?. preprocessOptions
137
+ if ( block . lang === 'pug' ) {
138
+ preprocessOptions = {
139
+ doctype : 'html' ,
140
+ ...preprocessOptions
141
+ }
142
+ }
143
+
136
144
return {
137
145
...options . template ,
138
146
id,
@@ -144,7 +152,7 @@ export function resolveTemplateCompilerOptions(
144
152
ssrCssVars : cssVars ,
145
153
transformAssetUrls,
146
154
preprocessLang : block . lang ,
147
- preprocessOptions : block . lang && options . template ?. preprocessOptions ,
155
+ preprocessOptions,
148
156
compilerOptions : {
149
157
...options . template ?. compilerOptions ,
150
158
scopeId : hasScoped ? `data-v-${ id } ` : undefined ,
You can’t perform that action at this time.
0 commit comments