Hi, I like that proposition. Is it possible to change ResourceTransformer and include ResourceDependencies in Tapestry 5.3.* ?
Best regards, Cezary On Sat, Oct 8, 2011 at 12:35 AM, Howard Lewis Ship <hls...@gmail.com> wrote: > True; so we need the Resource passed in, but also another object to > collect additional dependencies, to trigger reloads. Say: > > public interface ResourceTransformer > { > /** > * Read the source input stream and provide a new input stream of > the transformed content. > * > * @param source > * resource to be transformed > * @return stream of output content > * @throws IOException > */ > InputStream transform(Resource source, ResourceDependencies > dependencies) throws IOException; > } > > public interface ResourceDependencies { > // Adding a dependency tracks the dependency for changes; if the > dependency changes then, at a minimum, > // the main resource will be marked invalidated in any caches and > reloaded/rebuilt as necessary. > void addDependency(Resource dependency); > } > > > So, when you process an @import, you can use the source Resource to > find the corresponding imported Resource, and you can then add that > resource as a dependency. > > > On Fri, Oct 7, 2011 at 9:30 AM, Cezary Biernacki <cezary...@gmail.com> > wrote: > > On Fri, Oct 7, 2011 at 5:17 PM, Howard Lewis Ship <hls...@gmail.com> > wrote: > > > >> On Thu, Oct 6, 2011 at 11:23 AM, Cezary Biernacki <cezary...@gmail.com> > >> wrote: > >> > Hi, > >> > OK. I need to get a permission as code is owned by my employer, > hopefully > >> I > >> > should be able to get it next week. Anyway, it is easy to build such > >> > integration with Tapestry 5.3 by implementing ResourceTransformer > >> interface > >> > and contributing it StreamableResourceSource. > >> > > >> > For both CoffeeScript and LessCSS I use their JavaScript compilers > >> executed > >> > from Java using for Mozilla's Rhino. CoffeeScript source is used > >> > unmodified, but LessCSS required small bit of hacking. > >> > > >> > Only deficiency of ResourceTransformer is that does not support well > >> > situations when a resource includes other files, e.g. by @import > >> directive > >> > in LessCSS - relative location of transformed files is unknown (so > >> resolving > >> > included files can not relative) and there is no good way to inform > about > >> > changes to dependencies (solved in my hack, but it would not work in > >> T5.3). > >> > > >> > >> So, could this be addressed by passing the underlying Resource to the > >> ResourceTransformer? That's a minor change; it might be a breaking > >> one, but that's acceptable in a beta for functionality introduced in > >> the same release. > > > > > > Great idea, it would solve problems with relative resources. What about > > reporting of changes to included resources? I can not find a way to do > that > > in Tapestry 5.3 at least using non-internal services. > > > > Best regards, > > Cezary > > > > > > -- > Howard M. Lewis Ship > > Creator of Apache Tapestry > > The source for Tapestry training, mentoring and support. Contact me to > learn how I can get you up and productive in Tapestry fast! > > (971) 678-5210 > http://howardlewisship.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >