You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Qbyte Consulting <qb...@gmail.com> on 2016/08/11 19:46:59 UTC

using media attributes with @Import stylesheet

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)" />

Re: using media attributes with @Import stylesheet

Posted by Carlos Montero Canabal <ca...@gmail.com>.
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 <qb...@gmail.com> 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)" />