Re: background: url(${context: image}) in CSS file?
Use a relative path. In my applications I store my CSS in: src/main/webapp/assets/styles/ And my images in: src/main/webapp/assets/images/ An example of using a relative path in my CSS file: background-image: url('../images/logo.png'); The path is relative to the CSS file and NOT the page, so this should work fine on all pages. Hope this helps, Daniel deian wrote: Hi Guys, What can we do about using tapestry variables in the CSS files? I have a css file in where I want to use an image as background. So I want to use something along the lines: mySite.css .mystyle { background: url(${context:images/myImage.png}); } Any ideas? Cheers, Deian -- View this message in context: http://www.nabble.com/background%3A-url%28%24%7Bcontext%3A-image%7D%29-in-CSS-file--tp25786987p25802983.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
background: url(${context: image}) in CSS file?
Hi Guys, What can we do about using tapestry variables in the CSS files? I have a css file in where I want to use an image as background. So I want to use something along the lines: mySite.css .mystyle { background: url(${context:images/myImage.png}); } Any ideas? Cheers, Deian -- View this message in context: http://www.nabble.com/background%3A-url%28%24%7Bcontext%3A-image%7D%29-in-CSS-file--tp25786987p25786987.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: background: url(${context: image}) in CSS file?
Hello Why not using relative paths ? Christophe. 2009/10/7 deian deian.iva...@gmail.com Hi Guys, What can we do about using tapestry variables in the CSS files? I have a css file in where I want to use an image as background. So I want to use something along the lines: mySite.css .mystyle { background: url(${context:images/myImage.png}); } Any ideas? Cheers, Deian -- View this message in context: http://www.nabble.com/background%3A-url%28%24%7Bcontext%3A-image%7D%29-in-CSS-file--tp25786987p25786987.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: background: url(${context: image}) in CSS file?
Em Wed, 07 Oct 2009 10:49:16 -0300, deian deian.iva...@gmail.com escreveu: Hi Guys, Hi! What can we do about using tapestry variables in the CSS files? You could create a page class that returns CSS, but I haven't used this approach. I add a style tag to my layout component and then write all my Tapestry-dependent CSS there. -- Thiago H. de Paula Figueiredo Independent Java consultant, developer, and instructor http://www.arsmachina.com.br/thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: the image in css file
I can use the image file in tml file using the ${asset:context:/images/.gif} ,but how to use the image file in css file. Your CSS file is not being run through the template parser so you can't use template syntax. Here are a few options: You could define the style in your page. If you need it in a few places you could make it a component. That has the downside of adding page weight because it's inline with your html. I haven't tried this, but you could try making your CSS into a .tml file. Adding the @Meta annotation to change the returned content type: @Meta(value = {tapestry.response-content-type=text/css}) Your .tml needs to be valid XML so you'll have to wrap the whole thing in a t:container. The downside is this might be a waste of time and not work... and it adds a little overhead. If you're deploying your app to the root context (and thus don't have to worry about changing contexts) then you can just use absolute paths in your css (that's how I deploy...) Josh -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: the image in css file
Another option is to use relative URLs for images in your CSS file. That's how I deploy. -Filip On 2008-06-03 18:45, Josh Canfield wrote: I can use the image file in tml file using the ${asset:context:/images/.gif} ,but how to use the image file in css file. Your CSS file is not being run through the template parser so you can't use template syntax. Here are a few options: You could define the style in your page. If you need it in a few places you could make it a component. That has the downside of adding page weight because it's inline with your html. I haven't tried this, but you could try making your CSS into a .tml file. Adding the @Meta annotation to change the returned content type: @Meta(value = {tapestry.response-content-type=text/css}) Your .tml needs to be valid XML so you'll have to wrap the whole thing in a t:container. The downside is this might be a waste of time and not work... and it adds a little overhead. If you're deploying your app to the root context (and thus don't have to worry about changing contexts) then you can just use absolute paths in your css (that's how I deploy...) Josh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]