using media attributes with @Import stylesheet

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

using media attributes with @Import stylesheet

Qbyte Consulting
I'm moving my prototype pages to T5.4.

I've put this on my Layout class:
@Import(stylesheet
        = {"context:/layout/style.css",
"context:/layout/jquery.mobile-1.4.5.min.css"}, library
        = {"context:/js/init.js","jquery.mobile-1.4.5.min.js"})

How do I handle the media attributes (see below)?

John


      <link rel="stylesheet" type="text/css" href="layout/style.css"
media="screen, handheld" />
        <link rel="stylesheet" type="text/css" href="layout/enhanced.css"
media="screen  and (min-width: 40.5em)" />
Reply | Threaded
Open this post in threaded view
|

Re: using media attributes with @Import stylesheet

Carlos Montero Canabal
I think this code would work:

@Environmental
private JavaScriptSupport javaScriptSupport;

@Inject
@Path("css/material/bootstrap-material-design.css")
private Asset materialDesignCss;

void setupRender(){

javaScriptSupport.importStylesheet(new StylesheetLink(materialDesignCss, new StylesheetOptions("media and (min-width: 40.5em)")));

}

@Import is for easy use cases.

Regards

Carlos Montero

El 11/8/2016, a las 21:46, Qbyte Consulting <[hidden email]> escribió:

I'm moving my prototype pages to T5.4.

I've put this on my Layout class:
@Import(stylesheet
       = {"context:/layout/style.css",
"context:/layout/jquery.mobile-1.4.5.min.css"}, library
       = {"context:/js/init.js","jquery.mobile-1.4.5.min.js"})

How do I handle the media attributes (see below)?

John


     <link rel="stylesheet" type="text/css" href="layout/style.css"
media="screen, handheld" />
       <link rel="stylesheet" type="text/css" href="layout/enhanced.css"
media="screen  and (min-width: 40.5em)" />


smime.p7s (3K) Download Attachment