%!
from staticfiles.storage import staticfiles_storage
from pipeline_mako import compressed_css, compressed_js
from django.utils.translation import get_language_bidi
%>
<%def name='url(file, raw=False)'><%
try:
url = staticfiles_storage.url(file)
except:
url = file
%>${url}${"?raw" if raw else ""}%def>
<%def name='css(group, raw=False)'>
<%
rtl_group = '{}-rtl'.format(group)
if get_language_bidi() and rtl_group in settings.PIPELINE_CSS:
group = rtl_group
%>
% if settings.FEATURES['USE_DJANGO_PIPELINE']:
${compressed_css(group, raw=raw)}
% else:
% for filename in settings.PIPELINE_CSS[group]['source_filenames']:
% endfor
%endif
%def>
<%def name='js(group)'>
% if settings.FEATURES['USE_DJANGO_PIPELINE']:
${compressed_js(group)}
% else:
% for filename in settings.PIPELINE_JS[group]['source_filenames']:
% endfor
%endif
%def>
<%def name="include(path)"><%
from django.template.loaders.filesystem import _loader
source, template_path = _loader.load_template_source(path)
%>${source}%def>