Skip to content

Commit 8823fcc

Browse files
committed
expose preserveWhitespace option in template compiler
1 parent 6e96a65 commit 8823fcc

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/vue-template-compiler/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ The optional `options` object can contain the following:
5757
5858
Refer to the implementation of some [built-in compile-time directives](https://github.com/vuejs/vue/tree/next/src/platforms/web/compiler/directives).
5959
60+
- `preserveWhitespace`
61+
62+
Defaults to `true`. This means the compiled render function respects all the whitespaces between HTML tags. If set to `false`, all whitespaces between tags will be ignored. This can result in slightly better performance but may affect layout for inline elements.
63+
6064
---
6165
6266
### compiler.compileToFunctions(template)

src/entries/web-compiler.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function compile (
2424
const compiled = baseCompile(template, {
2525
modules,
2626
directives,
27+
preserveWhitespace: options.preserveWhitespace,
2728
warn: msg => {
2829
errors.push(msg)
2930
}

0 commit comments

Comments
 (0)