7
CSSのスニペットを動的に挿入しようとしています。理想的には、これはうまくいきます:JadeテンプレートにインラインCSSスタイルを書き込むときにjavascript変数を使用する方法
style(type='text/css')
#header a#logo { background:url(constants.logo) no-repeat; }
@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {
#header a#logo { background-image: url(constants.logo_2x); }
}
残念ながら、constants.logoは/文字通り/ DOMに配置されています。どのような仕事は次のとおりです:
!= "<style type='text/css'>"
!= "#header a#logo { background:url('"+constants.logo+"') no-repeat; }"
!= "@media only screen and (-webkit-min-device-pixel-ratio: 1.5) {"
!= " #header a#logo { background-image: url('"+constants.logo_2x+"'); }"
!= "}</style>"
良い方法はありますか?
ありがとうございます**とても** – johnny