Scala / Rise: Convert CSS Selector and DispatchSnippet

Can I use Lift CSS Selector Transforms with DispatchSnippet? This does not seem to work for me.

+4
source share
1 answer

Answering my question ... yes, it is possible! My problem was this: Snippet methods should be of type NodeSeq => NodeSeq, but CSS Transformations returns a () => CSSSel. CSSSel itself is NodeSeq => NodeSeq, so CSS conversion :() => (NodeSeq => NodeSeq).

This means that to use it with DispatchSnippet, the dispatcher should have the following:

def dispatch: DispatchIt = { case "method1" => normalSnippetMethod _ case "method2" => cssTransform // no _ ! } 

Basically, I just had an extra _ at the end.

+4
source

All Articles