def render(self, context):
code = self.nodelist.render(context)<EOL>if not settings.DJANGO_STATIC:<EOL><INDENT>if settings.DJANGO_STATIC_MEDIA_URL_ALWAYS:<EOL><INDENT>for match in STYLES_REGEX.finditer(code):<EOL><INDENT>for filename in match.groups():<EOL><INDENT>code = (code.replace(filename,<EOL>settings.DJANGO_STATIC_MEDIA_URL + filename))<EOL><DEDENT><DEDENT>for match in SCRIPTS_REGEX.finditer(code):<EOL><INDENT>for filename in match.groups():<EOL><INDENT>code = (code.replace(filename,<EOL>settings.DJANGO_STATIC_MEDIA_URL + filename))<EOL><DEDENT><DEDENT>return code<EOL><DEDENT>return code<EOL><DEDENT>new_js_filenames = []<EOL>for match in SCRIPTS_REGEX.finditer(code):<EOL><INDENT>whole_tag = match.group()<EOL>async_defer = ASYNC_DEFER_REGEX.search(whole_tag)<EOL>for filename in match.groups():<EOL><INDENT>optimize_if_possible = self.optimize_if_possible<EOL>if optimize_if_possible and(filename.endswith('<STR_LIT>') or filename.endswith('<STR_LIT>')):<EOL><INDENT>optimize_if_possible = False<EOL><DEDENT>new_js_filenames.append(filename)<EOL>code = code.replace(whole_tag, '<STR_LIT>')<EOL><DEDENT><DEDENT>if new_js_filenames:<EOL><INDENT>new_js_filename = _static_file(new_js_filenames,<EOL>optimize_if_possible=optimize_if_possible,<EOL>symlink_if_possible=self.symlink_if_possible)<EOL><DEDENT>else:<EOL><INDENT>new_js_filename = None<EOL><DEDENT>new_image_filenames = []<EOL>def image_replacer(match):<EOL><INDENT>tag = match.group()<EOL>for filename in match.groups():<EOL><INDENT>new_filename = _static_file(filename,<EOL>symlink_if_possible=self.symlink_if_possible)<EOL>if new_filename != filename:<EOL><INDENT>tag = tag.replace(filename, new_filename)<EOL><DEDENT><DEDENT>return tag<EOL><DEDENT>code = IMG_REGEX.sub(image_replacer, code)<EOL>new_css_filenames = defaultdict(list)<EOL>media_regex = re.compile('<STR_LIT>')<EOL>for match in STYLES_REGEX.finditer(code):<EOL><INDENT>whole_tag = match.group()<EOL>try:<EOL><INDENT>media_type = media_regex.findall(whole_tag)[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>media_type = '<STR_LIT>'<EOL><DEDENT>for filename in match.groups():<EOL><INDENT>new_css_filenames[media_type].append(filename)<EOL>code = code.replace(whole_tag, '<STR_LIT>')<EOL><DEDENT><DEDENT>new_css_filenames_combined = {}<EOL>if new_css_filenames:<EOL><INDENT>for media_type, filenames in list(new_css_filenames.items()):<EOL><INDENT>r = _static_file(filenames,<EOL>optimize_if_possible=self.optimize_if_possible,<EOL>symlink_if_possible=self.symlink_if_possible)<EOL>new_css_filenames_combined[media_type] = r<EOL><DEDENT><DEDENT>if new_js_filename:<EOL><INDENT>if async_defer:<EOL><INDENT>new_tag = ('<STR_LIT>' %<EOL>(async_defer.group(<NUM_LIT:0>), new_js_filename))<EOL><DEDENT>else:<EOL><INDENT>new_tag = '<STR_LIT>' % new_js_filename<EOL><DEDENT>code = "<STR_LIT>" % (new_tag, code)<EOL><DEDENT>for media_type, new_css_filename in list(new_css_filenames_combined.items()):<EOL><INDENT>extra_params = '<STR_LIT>'<EOL>if media_type:<EOL><INDENT>extra_params += '<STR_LIT>' % media_type<EOL><DEDENT>new_tag = '<STR_LIT>' %(extra_params, new_css_filename)<EOL>code = "<STR_LIT>" % (new_tag, code)<EOL><DEDENT>return code<EOL>
inspect the code and look for files that can be turned into combos.
        Basically, the developer could type this:
        {% slimall %}
          <link href="/one.css"/>
          <link href="/two.css"/>
        {% endslimall %}
        And it should be reconsidered like this:
          <link href="{% slimfile "/one.css;/two.css" %}"/>
        which we already have routines for doing.