You could take the quick and dirty way and have a tapestry filter redirect
to the correct asset paths.

We use this at work for things like rich text editors that attempts to load
stuff relative to the first js file loaded.

-- 
Chris

On Mon, Oct 13, 2014 at 3:37 PM, akshay <akshayestat...@gmail.com> wrote:

> Hi Thiago,
>
> Thanks for all your responses.I am still stuck with the problem related to
> the loading of images , when less to css compilation is forced by us.
>
> As I told you:
>
> In the less file the images are referenced with paths, like
>
> @product: url(../images/product.svg)--( though I agree that we can provide
> it with a prefix, but anyways this convention still use to work for me
> before).
>
> The tapestry considers the images as an asset and translates the given path
> as  :-
> (/appContext/assets/ctx/6787fbc2/images/product.svg), when I use the
> tapestry  default Less to css compilation
>
>
> But in my case the url path remains the same as "../images/product.svg" in
> the translated css, and is not treated as an asset.
>
>
> My approach:-
> xyz.less--which imports other less files containing
>
>
> I am directly using
>   @Inject
>   @Path("context:css/xyz.less")
>   private Asset lessFile;
>
>        LessResourceTransformer lessResourceTransformer = new
> LessResourceTransformer()
>         return lessResourceTransformer.transform(lessFile.getResource(),
>  new ResourceDependencies() {
>
>         @Override
>         public void addDependency(Resource dependency) {
>
>         }
>       });
>
> I debugged and found out that the images are created as an asset in
> AbstratAssetFactory class along with the help of few more classes. These
> classes are called very early in the framework flow, and are complex to
> re-use.
>
> As per my understanding , the Less transformer should by default take care
> of parsing and creating the url as
> (/appContext/assets/ctx/6787fbc2/images/product.svg)  in the less file.
> Debugging into the LessResourceTransformer class(which has very less java
> docs),makes bit tough for me to find out the actual solution to it.
>
>
> Any suggestions from you would be of great help.
>
>
> Best Regards
> Akshay
>
>
> *********************************************************************************************************************
>
> On Thu, Oct 9, 2014 at 10:44 PM, Thiago H de Paula Figueiredo <
> thiag...@gmail.com> wrote:
>
> > On Thu, 09 Oct 2014 17:18:04 -0300, akshay <akshayestat...@gmail.com>
> > wrote:
> >
> >  Hi Thaigo,
> >>
> >> Well the Url is :-
> >>
> >> localhost:8080/WebPortal/config/lessToCss
> >>
> >
> > So the URL should have been "/WebPortal/config/lessToCss".
> >
> > To avoid hardcoding, you can do this:
> >
> > @Inject
> > private PageRenderLinkSource pageRenderLinkSource;
> > ...
> > String cssUrl = pageRenderLinkSource.createPageRenderLink(
> > LessToCss.class).toAbsoluteURI();
> > javaScriptSupport.importStylesheet(new StylesheetLink(cssUrl));
> >
> > This will always work, as you're delegating the URL creation to Tapestry.
> >
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>
>
> --
> Cheers!!
> Akshay
>

Reply via email to