add a compile helper to compile to string

Add a compileToString helper function to return the template function as String for template compilation at compilation time.