def render_css(self, package, path): template_name = package.template_name or "pipeline/css.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/css'), 'url': mark_safe(staticfiles_storage.url(path)) }) return render_to_string(template_name, context)
def render_js(self, package, path): template_name = package.template_name or "pipeline/js.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/javascript'), 'url': staticfiles_storage.url(path) }) return render_to_string(template_name, context)
def render_js(package, path): # lint-amnesty, pylint: disable=missing-function-docstring template_name = package.template_name or "mako/js.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/javascript'), 'url': try_staticfiles_lookup(path) }) return render_to_string(template_name, context)
def render_js(package, path): template_name = package.template_name or "mako/js.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/javascript'), 'url': try_staticfiles_lookup(path) }) return render_to_string(template_name, context)
def render_js(self, package, path): """ Override render_js from django-pipline so that js file urls are based on the applied theme """ template_name = package.template_name or "pipeline/js.html" context = package.extra_context context.update({"type": guess_type(path, "text/javascript"), "url": mark_safe(get_static_file_url(path))}) return render_to_string(template_name, context)
def render_css(self, package, path): template_name = package.template_name or "pipeline/css.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/css'), 'url': self.get_url(path) }) return render_to_string(template_name, context)
def render_js(self, package, path): template_name = package.template_name or "pipeline/js.jinja" context = package.extra_context context.update({ 'type': guess_type(path, 'text/javascript'), 'url': staticfiles_storage.url(path) }) template = self.environment.get_template(template_name) return template.render(context)
def render_js(self, package, path): template_name = package.template_name or "pipeline/js_default.html" modified = staticfiles_storage.modified_time(path).timestamp() context = package.extra_context context.update({ 'type': guess_type(path, 'text/javascript'), 'url': mark_safe(staticfiles_storage.url(path)), 'modified': int(modified), }) return loader.render_to_string(template_name, context)
def render_css(package, path): template_name = package.template_name or "mako/css.html" context = package.extra_context url = try_staticfiles_lookup(path) context.update({ 'type': guess_type(path, 'text/css'), 'url': url, }) return render_to_string(template_name, context)
def _render_css(path): template_name = package.template_name or "pipeline/css.jinja" context = package.extra_context context.update({ 'type': guess_type(path, 'text/css'), 'url': staticfiles_storage.url(path) }) return render_to_string(template_name, context)
def render_js(self, package, path): """ Override render_js from django-pipline so that js file urls are based on the applied theme """ template_name = package.template_name or "pipeline/js.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/javascript'), 'url': mark_safe(get_static_file_url(path)) }) return render_to_string(template_name, context)
def _render_css(path): template_name = package.template_name or "pipeline/css.jinja" context = package.extra_context context.update({ 'type': guess_type(path, 'text/css'), 'url': staticfiles_storage.url(path) }) template = ctx.environment.get_template(template_name) return template.render(context)
def render_css(self, package, path): """ Override render_css from django-pipline so that stylesheets urls are based on the applied theme """ template_name = package.template_name or "pipeline/css.html" context = package.extra_context context.update({ 'type': guess_type(path, 'text/css'), 'url': mark_safe(get_static_file_url(path)) }) return render_to_string(template_name, context)
def render_css(package, path, raw=False): # lint-amnesty, pylint: disable=missing-function-docstring template_name = package.template_name or "mako/css.html" context = package.extra_context url = try_staticfiles_lookup(path) if raw: url += "?raw" context.update({ 'type': guess_type(path, 'text/css'), 'url': url, }) return render_to_string(template_name, context)
def render(self, path): """Render the HTML tag.""" if not self.package.template_name: template_name = {"js": "pipeline/js.jinja", "css": "pipeline/css.jinja"}[self.package_type] else: template_name = self.package.template_name mimetype = {"js": "text/javascript", "css": "text/css"}[self.package_type] context = self.package.extra_context context.update({"type": guess_type(path, mimetype), "url": staticfiles_storage.url(path)}) env = Environment(loader=self.loader) tpl = env.get_template(template_name) return tpl.render(**context)
def render(self, path): """Render the HTML tag.""" if not self.package.template_name: template_name = { 'js': 'pipeline/js.jinja', 'css': 'pipeline/css.jinja', }[self.package_type] else: template_name = self.package.template_name mimetype = { 'js': 'text/javascript', 'css': 'text/css', }[self.package_type] context = self.package.extra_context context.update({ 'type': guess_type(path, mimetype), 'url': staticfiles_storage.url(path) }) env = Environment(loader=self.loader) tpl = env.get_template(template_name) return tpl.render(**context)
def test_guess_type(self): self.assertEqual('text/css', guess_type('stylesheet.css')) self.assertEqual('text/coffeescript', guess_type('application.coffee')) self.assertEqual('text/less', guess_type('stylesheet.less'))
def render_css(self, package, path): template_name = package.template_name or "pipeline/css.html" context = package.extra_context context.update({"type": guess_type(path, "text/css"), "url": staticfiles_storage.url(path)}) return render_to_string(template_name, context)