def render_include(content):
 content = cstr(content)
 for i in xrange(5):
  if (u'{% include' in content):
   paths = re.findall(u'{% include\\s[\'"](.*)[\'"]\\s%}', content)
   if (not paths):
    frappe.throw(u'Invalid include path', InvalidIncludePath)
   for path in paths:
    (app, app_path) = path.split(u'/', 1)
    with open(frappe.get_app_path(app, app_path), u'r') as f:
     include = unicode(f.read(), u'utf-8')
     if path.endswith(u'.html'):
      include = html_to_js_template(path, include)
     content = re.sub(u'{{% include\\s[\'"]{0}[\'"]\\s%}}'.format(path), include, content)
  else:
   break
 return content

def render_include ( content ) : content = cstr ( content ) for i in xrange ( 5 ) : if ( u'{% include' in content ) : paths = re . findall ( u'{% include\\s[\'"](.*)[\'"]\\s%}' , content ) if ( not paths ) : frappe . throw ( u'Invalid include path' , InvalidIncludePath ) for path in paths : ( app , app_path ) = path . split ( u'/' , 1 ) with open ( frappe . get_app_path ( app , app_path ) , u'r' ) as f : include = unicode ( f . read ( ) , u'utf-8' ) if path . endswith ( u'.html' ) : include = html_to_js_template ( path , include ) content = re . sub ( u'{{% include\\s[\'"]{0}[\'"]\\s%}}' . format ( path ) , include , content ) else : break return content
render {% raw %}{% include "app/path/filename" %}{% endraw %} in js file .