I’m trying to dynamically insert snippets of CSS. Ideally, this would work:
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); }
}
Unfortunately, constants.logo is /literally/ placed in the DOM. What does work is the following:
!= "<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>"
Is there a better way?
Use
#{variable}to print a variable within an element’s text.