From bd9a7c4a48faaff54468066821099e89c1302b9c Mon Sep 17 00:00:00 2001 From: ChenGuangjun Date: Wed, 10 May 2017 18:31:07 +0800 Subject: [PATCH 1/4] Trim templates before pug compiling (#86) --- src/template/pug.js | 3 ++- test/fixtures/pug.vue | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/template/pug.js b/src/template/pug.js index 73ecadf..625c0ea 100644 --- a/src/template/pug.js +++ b/src/template/pug.js @@ -1,6 +1,7 @@ export default async function (template, extras, options) { const pug = require('pug') - const compiler = pug.compile(template, { filename: extras.id, ...options.pug }) + const trim = typeof template === 'string' ? template.trim : template + const compiler = pug.compile(trim, { filename: extras.id, ...options.pug }) return compiler({css: extras.modules || {}}) } diff --git a/test/fixtures/pug.vue b/test/fixtures/pug.vue index 3f3577d..db762a9 100644 --- a/test/fixtures/pug.vue +++ b/test/fixtures/pug.vue @@ -1,5 +1,5 @@