I noticed in the Closure Stylesheet docs that you can define your own
custom functions in Java when you use the *--gss-function-map-provider* flag.
Is there this option with GWT?
I did notice that GwtGssFunctionMapProvider provides extra GSS GWT
functions, but found no way of extending this for my own custom methods.
The GssResourceGenerator constructs it via a new. It would be nice to
extend GwtGssFunctionMapProvider, or create a new class that
GwtGssFunctionMapProvider uses to add custom functions.
I would propose changing GwtGssFunctionMapProvider to:
public class GwtGssFunctionMapProvider extends DefaultGssFunctionMapProvider {
private final ResourceContext context;
public GwtGssFunctionMapProvider() {
}
public void setResourceContext(ResourceContext context) {
this.context = context;
}
@Override
public Map<String, GssFunction> get() {
Map<String, GssFunction> gssFunctionMap = super.get();
return ImmutableMap.<String, GssFunction>builder().putAll(gssFunctionMap)
// TODO add a namespace for gwt-specific function ?
.put(EvalFunction.getName(), new EvalFunction())
.put(ValueFunction.getName(), new ValueFunction())
.put(ResourceUrlFunction.getName(), new ResourceUrlFunction(context))
.build();
}
}
This would allow it to be constructed with no arguments, which allows
Reflection to easily be used to construct the object. Next we could change
GssResourceGenerator to look for a configuration-property to be added to the
gwt.xml file to define the new class that must extend
GwtGssFunctionMapProvider, could then add custom functions.
If this sounds like an interesting approach, I could start coding a patch to
accomplish this.
Thanks,
Jeffrey
--
You received this message because you are subscribed to the Google Groups "GWT
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit-contributors/3135e1af-bdce-45ed-bfbf-4d3192573e25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.