You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by stephanos2k <st...@googlemail.com> on 2011/07/11 15:18:42 UTC
how to use asset from component library in template?
I'm in the middle of moving assets from one "monolithic" Tapestry app to a
'common' base library assets.
Of course now I have to adapt my asset paths, but it's somewhat awkward:
new asset path: /com/mycompany/style.css/
old layout path: /com.appname.components.Layout.tml/
Now when I want to reference the styesheet in my layout, the only way I
could make it work was:
<link href="${asset:/../../mycompany/style.css}"/>
*Isn't there a better way?*
PS: I also added a LibraryMapping for "com.mycompany" and can correctly load
components from the libarary.
Couldn't I use this virtual folder to access the assets directly somehow?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-use-asset-from-component-library-in-template-tp4574973p4574973.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: how to use asset from component library in template?
Posted by stephanos2k <st...@googlemail.com>.
Thanks for the explanation! Very much appreciated :-)
On Mon, Jul 11, 2011 at 9:30 PM, Nillehammer-2 [via Tapestry] <
ml-node+4576210-1636130599-151547@n5.nabble.com> wrote:
> Hi stephanos2k,
> > By the way, the stylesheet in my library references some images
> > [background-image: "/images/error.png"], what's the best way to make this
>
> > work when using the library?
> CSS files are assets that are not parsed like templates. So dynamic
> insertion of asset paths won't work here. To make background-image urls
> work with assets either put them into a style-addribute in the
> particular element or use a <style>...</style> section in your
> template(s). I myself use the latter and have put everything together in
> my layout component.
>
> Regards, nillehammer
>
> --
> http://www.winfonet.eu
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4576210&i=0>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=4576210&i=1>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://tapestry.1045711.n5.nabble.com/how-to-use-asset-from-component-library-in-template-tp4574973p4576210.html
> To unsubscribe from how to use asset from component library in template?, click
> here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4574973&code=c3RlcGhhbi5iZWhua2VAZ29vZ2xlbWFpbC5jb218NDU3NDk3M3w0OTkxMDQ0NDk=>.
>
>
--
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-use-asset-from-component-library-in-template-tp4574973p4579225.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
Re: how to use asset from component library in template?
Posted by nillehammer <ta...@winfonet.eu>.
Hi stephanos2k,
> By the way, the stylesheet in my library references some images
> [background-image: "/images/error.png"], what's the best way to make this
> work when using the library?
CSS files are assets that are not parsed like templates. So dynamic
insertion of asset paths won't work here. To make background-image urls
work with assets either put them into a style-addribute in the
particular element or use a <style>...</style> section in your
template(s). I myself use the latter and have put everything together in
my layout component.
Regards, nillehammer
--
http://www.winfonet.eu
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: how to use asset from component library in template?
Posted by stephanos2k <st...@googlemail.com>.
> Have you tried <link href="${classpath:/com/mycompany/style.css}"/>?
/Could not convert 'classpath:/com/mycompany/style.css' into a component
parameter binding: Error parsing property expression
'classpath:/com/mycompany/style.css': Unable to parse input at character
position 11./
(v5.3)
> Better yet, why don't you use @Import?
Well, this is a long story. The gist is that I'm using tools like
CoffeeScript, LessCSS and HeadJS - so the files I use in development are
different from the ones in production.
By the way, the stylesheet in my library references some images
[background-image: "/images/error.png"], what's the best way to make this
work when using the library?
--
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-use-asset-from-component-library-in-template-tp4574973p4575317.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: how to use asset from component library in template?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Mon, 11 Jul 2011 10:18:42 -0300, stephanos2k
<st...@googlemail.com> wrote:
> I'm in the middle of moving assets from one "monolithic" Tapestry app to
> a 'common' base library assets.
> Of course now I have to adapt my asset paths, but it's somewhat awkward:
>
> new asset path: /com/mycompany/style.css/
> old layout path: /com.appname.components.Layout.tml/
>
> Now when I want to reference the styesheet in my layout, the only way I
> could make it work was:
> <link href="${asset:/../../mycompany/style.css}"/>
>
> *Isn't there a better way?*
Have you tried <link href="${classpath:/com/mycompany/style.css}"/>?
Better yet, why don't you use @Import?
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org