question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose preserveWhitespace to vue-template-loader

See original GitHub issue

Thanks for all your hard work on vue-template-loader!

Would it be possible to expose the preserveWhitespace option as discussed here: https://github.com/vuejs/vue/issues/3934

At present my input looks like this:

<p>
	My gross annual salary is
</p>

And my output looks like this:

_c('p',[_vm._v("\r\n\t\tMy gross annual salary is\r\n\t\t")

I would love it to look like this:

_c('p',[_vm._v("My gross annual salary is")

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kennardconsultingcommented, Feb 8, 2018

Investigating this some more, I’ve realized that - for my use case - it would be sufficient to chain the loader with something that can strip the whitespace. However (possibly because of the inline/normal/post loader thing) I don’t seem to be able to do this:

		test: /\.html$/,
		use: [ {
			loader: 'html-loader',
			options: {
				minimize: true
			}
		}, 'vue-template-loader' ]

The vue-template-loader ignores the html-loader. Is there a way to make this work?

0reactions
kennardconsultingcommented, Jan 31, 2018

Thanks for being so responsive!

I take your point. I understand now that this won’t solve my problem. It may be useful to expose it for now anyway, and hopefully expose some other option in the future (preserveWhitespaceWithinElements or something).

It’s actually a correctness issue, I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Options Reference - Vue Loader
During template compilation, the compiler can transform certain ... or discard whitespaces between template tags with { preserveWhitespace: false } .
Read more >
perserveWhitespace: false · Issue #1020 · vuejs/vue-cli - GitHub
preserveWhitespace : false White space is an expected design pattern ... can configure it by tapping vue-loader 's option in vue.config.js .
Read more >
Spaces are gone in HTML after upgrading to vue-cli 3
You can configure the vue-loader's template compiler option preserveWhitespace to true using the vue.config.js file
Read more >
vue-template-compiler | Yarn - Package Manager
This package can be used to pre-compile Vue 2.0 templates into render functions to avoid runtime-compilation overhead and CSP restrictions.
Read more >
Using vue-loader to create single-page applications
Setting up our new Vue.js project · vue-loader and vue-template-compiler transpile Vue files into JavaScript · babel-loader converts ES6 code to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found