Hey guys,

HashedFileMixin's pattern variable looks like it could be extended for 
other file types:

class HashedFilesMixin(object):    
    default_template = """url("%s")"""
    patterns = (
        ("*.css", (
            r"""(url\(['"]{0,1}\s*(.*?)["']{0,1}\))""",
            (r"""(@import\s*["']\s*(.*?)["'])""", """@import url("%s")"""),
        )),
    )


But - if I read the code right - it can't. Because in post_process, the 
patterns are applied to all files matched by any of the extensions. 

What I like to be able to achieve is get cache busting in some of my js 
files as well. I marked all static file references in my code with a 
'staticFile()' call and then tried to customize django's 
CachedStaticFilesStorage like this:

class MyCachedStaticFilesStorage(django.contrib.staticfiles.storage.
CachedStaticFilesStorage):
    patterns = django.contrib.staticfiles.storage.HashedFilesMixin.patterns 
+ (
        (u'*.js', [
            (r"""(staticFile\(['"]{0,1}\s*(.*?)["']{0,1}\))""", r
"""staticFile("%s")""", )
        ]),
    )


As of today, that won't work, since all CSS rules are applied to my JS, 
too, which causes some stuff to be replaced that shouldn't.

Is this a bug, and should I file a bug report? Is it worth fixing? How else 
can I get cache busting into JS files?

Thanks,
Bernhard
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2e94c2f3-5c91-4bb7-80fb-c40bdbb3b636%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to