如何在jade中添加HTML标签? [英] How do I put a html tag conditional in jade?
问题描述
在翡翠中,我希望将html标签置于这个方法,它放入
<! - [if lt IE 7]> < html class =ie6>百分比抑制率ENDIF] - GT!;
<! - [if IE 7]> < html class =ie7>百分比抑制率ENDIF] - GT!;
<! - [if IE 8]> < html class =ie8>百分比抑制率ENDIF] - GT!;
<! - [if IE 9]> < html class =ie9>百分比抑制率ENDIF] - GT!;
<! - [if(gt IE 9)|!(IE)]><! - > < html class => <! - <![ENDIF] - GT;
位于HTML文件的顶部。
我试过了
// [if lt IE 7]> < html class =no-js ie6 oldielang =en> <![endif]
// [if IE 7]> < html class =no-js ie7 oldielang =en> <![endif]
// [if IE 8]> < html class =no-js ie8 oldielang =en> <![endif]
// [if gt IE 8]><! - > < html class =no-jslang =en> <! - <![endif]
head
...
<但是jade忽略了html标签,并且不会在最后写入< / html>
标签。这是无效的HTML,导致IE不显示任何东西。
有没有办法做到这一点?
我想我会在没有办法的情况下使用javascript解决方案。
>此方法适用于关闭html标记:
!!! 5
// if if IE 7
< html class =no-js lt-ie9 lt-ie8 lt-ie7>
// if IE 7
< html class =no-js lt-ie9 lt-ie8>
// if IE 8
< html class =no-js lt-ie9>
// [如果gt IE 8]< ;!
html(class =no-js,lang =en)
//<![endif]
head
title = title
body!= body
from: $ / $> $ / $> 更新: 正如指出的那样kumar-harsh 此行为现在已被折旧,如果您需要此功能,您现在应该使用常规html: 来自: https://github.com/visionmedia/jade/issues/1345?source=cc#issuecomment-31920732 In jade, I want to put in a html tag conditional as per this method, which puts in at the top of a html file. I tried but jade ignores the html tag, and doesn't write in the end Is there any way of doing it? I'm thinking I'll just use a javascript solution if there isn't a way. from: https://gist.github.com/kmiyashiro/1140425#comment-675550 Update: As pointed out by kumar-harsh this behaviour has now been depreciated, if you need this functionality you now should use regular html: from: https://github.com/visionmedia/jade/issues/1345?source=cc#issuecomment-31920732 这篇关于如何在jade中添加HTML标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
<! - [if IE]>
< html class =ie>
<![endif] - >
<![if!IE]>
< html class =not-ie>
<![endif]>
< / html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
//[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]
//[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]
//[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]
//[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]
head
...
</html>
tag. This is invalid html, and results in IE not displaying anything at all.This method works, with the closing html tag: !!! 5
//if lt IE 7
<html class="no-js lt-ie9 lt-ie8 lt-ie7">
//if IE 7
<html class="no-js lt-ie9 lt-ie8">
//if IE 8
<html class="no-js lt-ie9">
// [if gt IE 8] <!
html(class="no-js", lang="en")
// <![endif]
head
title= title
body!= body
<!--[if IE]>
<html class="ie">
<![endif]-->
<![if !IE]>
<html class="not-ie">
<![endif]>
</html>