Exemplo n.º 1
0
 def handle(self, *args, **options):
     """
     Cache Static Files
     """
     possible_js_cache = os.path.join(generate_cache_dir(get_main_js_dir()), "mediabrute_usefile")
     
     if os.path.isfile(possible_js_cache):
         os.unlink(possible_js_cache)
     
     js_urls = handlers.minify_js()
     js_file = open(possible_js_cache, "w")
     for url in js_urls:
         js_file.writelines(js_urls)
     js_file.close()
     
     
     possible_css_cache = os.path.join(generate_cache_dir(get_main_css_dir()), "mediabrute_usefile")
     
     if os.path.isfile(possible_css_cache):
         os.unlink(possible_css_cache)
     
     css_urls = handlers.minify_css()
     css_file = open(possible_css_cache, "w")
     for url in css_urls:
         css_file.writelines(css_urls)            
     css_file.close()
     
Exemplo n.º 2
0
def mini_css(app_name=None):
    """
    {{ MINI_CSS }} Context Processor
    
    Gives a full URL to the minified, cached CSS
    """
    return {"MINI_CSS": minify_css(app_name)}
Exemplo n.º 3
0
    def handle(self, *args, **options):
        """
        Cache Static Files
        """
        possible_js_cache = os.path.join(generate_cache_dir(get_main_js_dir()),
                                         "mediabrute_usefile")

        if os.path.isfile(possible_js_cache):
            os.unlink(possible_js_cache)

        js_urls = handlers.minify_js()
        js_file = open(possible_js_cache, "w")
        for url in js_urls:
            js_file.writelines(js_urls)
        js_file.close()

        possible_css_cache = os.path.join(
            generate_cache_dir(get_main_css_dir()), "mediabrute_usefile")

        if os.path.isfile(possible_css_cache):
            os.unlink(possible_css_cache)

        css_urls = handlers.minify_css()
        css_file = open(possible_css_cache, "w")
        for url in css_urls:
            css_file.writelines(css_urls)
        css_file.close()
Exemplo n.º 4
0
def mini_css(app_name=None):
    """
    {{ MINI_CSS }} Context Processor
    
    Gives a full URL to the minified, cached CSS
    """
    return {"MINI_CSS": minify_css(app_name)}