forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <>
Subject Re: Javascript file processing...
Date Wed, 04 Jan 2006 23:09:58 GMT
Ross Gardler wrote:
> CFAS Webmaster wrote:
> >All,
> >
> > I'm submitting this to the dev list because I *think* this is new 
> >behaviour in 0.8.  I haven't tried it again with 0.7 as this machine is 
> >a bit low on disk space.
> >
> > I have an HTML file that I'm processing through Forrest, 
> > if you're interested.  
> >It included a Javascript file in a <script> tag.  Unfortunately Forrest 
> >is trying to process the tag contents and replace them.

That is not really what is happening. Cocoon is looking
in the standard places and not finding the specified resource.

> >The error message is this:
> >
> >X [0]                                     Committees/dues.js     BROKEN: 
> >/home/kronenpj/src/svn/forrest/main/webapp/./resources/scripts/Committees/dues.js

> >(No such file or directory)
> >
> >While it's true that the ./resources/scripts/Committees/dues.js file 
> >doesn't exist, that's not how I'm referencing it in the HTML file.  The 
> >tag is this in the source, in the Committees subdirectory:
> >
> ><script src="dues.js" language="javascript" 
> >type="text/javascript"></script>
> >
> >While I can place the Javascript file into Forrest's 
> >resources/scripts/Committees, that's not where I feel it belongs.  I 
> >would like to know what piece within Forrest to change to make it 
> >comply, if that's possible.

"How to include additional Javascript and CSS files?"

Don't forget that you need the special URL /skin/dues.js
or perhaps /skin/Committees/dues.js to match.

However, if this is "legacy html" (i.e. you cannot
edit the sources), then add the javascript to the
default resources/scripts/ directory. The trouble will
then be that Cocoon will use relative references from
there so it will look in resources/scripts/Committees/
and resources/scripts/Committees/sub-dir/ ... yuk.

You can see that default match at main/webapp/resources.xmap
line 153 ...
<!-- @deprecated -->
<map:match pattern="**.js">
 <map:read src="resources/scripts/{1}.js" mime-type="application/x-javascript" />

I wonder if we should change that so that it first
looked in sub-directories and then looked at the
top-level of resources/scripts/

That says "deprecated". I wonder why. Supposedly
because now the main technique is that skin-specific
method described in the FAQ. However this is still
needed for legacy html.

BTW, how will this be handled with Dispatcher?
Would it still use the technique described in the FAQ?

Otherwise Paul, as always you can over-ride any
match as Ross describes below.


> Don't touch the Forrest core files (unless you feel your modification 
> would be useful to a wider audience).
> If you don't like the location Forrest wants to put scripts then simply 
> write a match in your project sitemap to intercept this request. 
> Something like:
> <map:match pattern="dues.js">
>   <map:read src="{project:content}/foo/bar/dues.js" .../>
> </map:match>
> Ross

View raw message