foo
diff --git a/src/template/pug.js b/src/template/pug.js index 817338d..5468697 100644 --- a/src/template/pug.js +++ b/src/template/pug.js @@ -1,7 +1,6 @@ export default async function (template, extras, options) { const pug = require('pug') - const trim = typeof template === 'string' ? template.trim() : template - const compiler = pug.compile(trim, { filename: extras.id, ...options.pug }) + const compiler = pug.compile(template, { filename: extras.id, doctype: 'html', ...options.pug }) return compiler({css: extras.modules || {}}) } diff --git a/src/vueTransform.js b/src/vueTransform.js index e58c826..27f1b22 100644 --- a/src/vueTransform.js +++ b/src/vueTransform.js @@ -52,11 +52,11 @@ async function processTemplate (source, id, content, options, nodes, modules) { debug(`Process template: ${id}`) const extras = { modules, id, lang: source.attrs.lang } - const { code } = source - const template = deIndent( - await (options.disableCssModuleStaticReplacement !== true - ? templateProcessor(code, extras, options) - : code) + const code = deIndent(source.code) + const template = await ( + options.disableCssModuleStaticReplacement !== true + ? templateProcessor(code, extras, options) + : code ) if (!options.compileTemplate) { diff --git a/test/expects/pug.js b/test/expects/pug.js index 6c2d0fc..cfe497f 100644 --- a/test/expects/pug.js +++ b/test/expects/pug.js @@ -1,3 +1,3 @@ -var pug = { template: "
foo
foo
nothing
",cssModules: {"test":"pug__test"},}; export default pug; diff --git a/test/fixtures/pug.vue b/test/fixtures/pug.vue index a84299e..1763cf9 100644 --- a/test/fixtures/pug.vue +++ b/test/fixtures/pug.vue @@ -1,11 +1,13 @@ - div(class=css.test class='keep-me') + div(class=css.test class='keep-me' v-if="true") article p foo + p(v-else) + | nothing + -