咕噜玉编译器填写空白属性 [英] Grunt jade compiler filling out empty attributes
问题描述
我使用grunt-contrib-jade模块编译我的Jade模板,如果我将属性留空如下行: code> article(ui-view)
它会被编译为:
< article ui-view =ui-view>< / article>
这会破坏我的AngularJS ui路由器,因为它不会处理ui-view指令就好像它是一个命名视图(不是我想要的)。当然,这是一个选项来写这样的玉文件:
article(ui-view ='')
但这不是我想要的,是否有某种方法可以阻止翡翠编译器填写空属性?
在 doctype html
$ c> .jade 文件。
对于没有 doctype
的部分,也可以通过传递 { doctype:'html'}
作为调用Jade时的选项:
jade -O{doctype: 'html'}partial.jade
它适用于 grunt-contrib- jade
也可以通过将 doctype:'html'
添加到选项中,如下所示:
jade:{
devel:{
options:{
pretty:true,
doctype:'html'
},
档案:[{
展开:真,
cwd:'src',
src:['** / *。jade'],
dest:' ''
ext:'.html'
}]
}
}
I'm using the grunt-contrib-jade module to compile my Jade templates, if I leave my attribute blank like the following line:
article(ui-view)
It will compile to:
<article ui-view="ui-view"></article>
And that will break my AngularJS ui-router, as it will not handle the "ui-view" directive as if it is a named view (not what I want). Of course it's an option to write my jade file like this:
article(ui-view='')
But that's not what I want, is there some way to stop the jade compiler from filling out empty attributes?
Everything seems good when there's doctype html
at the beginning of the .jade
file.
For partials that does not have doctype
, it can also be solved by passing {doctype: 'html'}
as option when calling Jade:
jade -O "{doctype:'html'}" partial.jade
It works for grunt-contrib-jade
too by adding doctype: 'html'
to the options, like so:
jade: {
devel: {
options: {
pretty: true,
doctype: 'html'
},
files: [{
expand: true,
cwd: 'src',
src: [ '**/*.jade' ],
dest: 'app',
ext: '.html'
}]
}
}
这篇关于咕噜玉编译器填写空白属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!