<commit_before>from jingo import register
from jingo_minify.helpers import get_css_urls
from jinja2 import Markup


@register.function
def less_css(bundle):
    """
    Similar to jingo_minify's css helper, but uses rel="stylesheet/less"
    instead of rel="stylesheet".
    """
    urls = get_css_urls(bundle)
    link_tag = '<link rel="stylesheet/less" media="screen,projection,tv" href="{0}" />'
    return Markup('\n'.join([link_tag.format(url) for url in urls]))<commit_msg>Do not use rel="stylesheet/less" when TEMPLATE_DEBUG is False.<commit_after>from django.conf import settings

from jingo import register
from jingo_minify.helpers import css, get_css_urls
from jinja2 import Markup


@register.function
def less_css(bundle):
    """
    Similar to jingo_minify's css helper, but uses rel="stylesheet/less"
    instead of rel="stylesheet" when TEMPLATE_DEBUG is True. If
    TEMPLATE_DEBUG is False, this passes the call on to the css helper.
    """
    if not settings.TEMPLATE_DEBUG:
        return css(bundle)

    urls = get_css_urls(bundle)
    link_tag = '<link rel="stylesheet/less" media="screen,projection,tv" href="{0}" />'
    return Markup('\n'.join([link_tag.format(url) for url in urls]))
{'fraction_non_alphanumeric': 0.11129431162407255, 'fraction_numerical': 0.0032976092333058533, 'mean_word_length': 4.468468468468468, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5079047', 'n_tokens_mistral': 390, 'n_tokens_neox': 385, 'n_words': 111}