Skip to content

Commit bd9a7c4

Browse files
author
ChenGuangjun
committed
Trim templates before pug compiling (vuejs#86)
1 parent 713c5a6 commit bd9a7c4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/template/pug.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export default async function (template, extras, options) {
22
const pug = require('pug')
3-
const compiler = pug.compile(template, { filename: extras.id, ...options.pug })
3+
const trim = typeof template === 'string' ? template.trim : template
4+
const compiler = pug.compile(trim, { filename: extras.id, ...options.pug })
45

56
return compiler({css: extras.modules || {}})
67
}

test/fixtures/pug.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template lang="pug">
2-
div(class=css.test class='keep-me') foo
2+
div(class=css.test class='keep-me') foo
33
</template>
44

55
<script lang="babel">

0 commit comments

Comments
 (0)