Is it possible to set Jade doctype in a way like this?
https://github.com/webpack/jade-loader/pull/24
The reason is to treat the boolean attributes in a better way http://jade-lang.com/reference/attributes/
Hmm not really. However when you bundle in webpack's production mode, the final markup is piped through html-minifier which will get rid of mirrored attributes.
If I use this Jade template
mobile-header(title="Home" hide-back)
section.content.home
div.content-padded
img(src='http://lorempixel.com/480/240/')
I get
[Vue warn]: Invalid prop: type check failed for hideBack="hide-back". Expected Boolean, got String.
Is it correct to fix it just putting the following at the top of the template?
doctype html
Yeah, that should be fine. The doctype won't output to the final HTML.
Thank you very much for what you do. This is a very, very cool.
I found another way, but it breaks the highlight in the editor.
Based on this
https://github.com/vuejs/vue-loader/blob/master/lib/loader.js#L110
<template lang="jade&doctype=html">
Maybe you can do that would vue-loader took options from webpack.config.js by lang and passed them then
vue: {
jade: {
doctype: "html"
}
}
Not exactly pretty, but it sets the doctype. You can also pass variables to jade for rendering
vue: {
loaders: {
jade: "vue-html-loader!vue-loader/lib/template-loader.js?raw&engine=jade&doctype=html"
}
}
Couldn't find this in the documentation, but this also works:
vue: {
template: {
doctype: "html"
}
}
For webpack2, modify the vue-loader rules entry (for vue-loader < 9.6, you'll need to use LoaderOptionsPlugin):
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
template: {
doctype: "html"
}
}
},
@nkovacs you're right, see PR https://github.com/vuejs/vue-loader/pull/226
Most helpful comment
Couldn't find this in the documentation, but this also works:
For webpack2, modify the vue-loader rules entry (for vue-loader < 9.6, you'll need to use LoaderOptionsPlugin):