ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From supareno <reno.rkc...@free.fr>
Subject Re: Ant Difference of Two Relative Paths?
Date Tue, 06 Jan 2009 19:49:51 GMT
iamleppert a écrit :
> Is it possible somehow using the pathconvert task to translate one relative
> path to another, given a "reference point"?
>
> E.g.
>
> Given the following directory structure:
>
> modules/mymodule/resources/css/something.css
>
> I have relative paths in something.css like the following:
>
> background-image: url(../images/image.gif);
>
> I am copying and concating the CSS with another CSS, located in:
>
> apps/myapp/resources/css/somethingelse.css
>
> The base dir for the entire project is the root which contains both apps and
> modules. (/ in this case)
>
> I want to replace the ../images/image.gif in something.css with another
> relative path, relative to apps/myapp/resources/css (the somethingelse.css
> file), e.g:
>
> ../../../../modules/mymodule/resources/images/image.gif
>
> If possible, it should have support for nested directories within
> resources/css, so that resources/css/dir1/dir2/something.css will have its
> paths translated correctly with the appropriate number of ../ prefixes.
>
> That way, the image will be able to be found when both CSS are concated
> together in its new location in 
> apps/myapp/resources/css/, and I won't have to resort to using absolute
> paths. Is this at all possible using pathconvert and a map or sorts? Or
> would I be better of creating my own custom task?
>
> Any pointers appreciated.
>
> Thanks!
>
> Johnathan
>   
Jonathan,

you could use the filter task 
(http://ant.apache.org/manual/CoreTasks/filter.html) be i'm not sure 
that it will be a suitable solution for your problem.

in my opinion, the best way is to concatenate and move the css file 
created file to a new css folder created to receive these files (and the 
images too),

first file:
modules/mymodule/resources/css/something.css
second file:
apps/myapp/resources/css/somethingelse.css

created file: myconcatenatedfile.css

can you put the new file in the new project structure css folder? (see 
below the structure)

<your_app>
    ...
    css/
     - myconcatenatedfile.css
    images/
     - image.gif
    ...

is it possible?

supareno

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message