Пример #1
0
def tag_version(name):
    app = current_app
    src_path = path.join(app.static_folder, 'img', name)
    name, ext = path.splitext(name)
    version = md5sum(src_path)
    versioned_name = "%s_%s%s" % (name, version, ext)
    relative_built_path = path.join('built', 'img', versioned_name)
    built_path = path.join(app.static_folder, relative_built_path)
    copyp(src_path, built_path)
    return relative_built_path
Пример #2
0
def cssrewrite_replace(url):
    app = current_app
    if url[0] == '/':
        url = url[1:]
    else:
        url = path.join('img', url)
    src = path.join(app.static_folder, url)
    version = md5sum(urlparse(src).path)
    name, ext = path.splitext(url)
    name = path.join("built", "%s_%s%s" % (name, version, ext))
    dest = path.join(app.static_folder, name)
    copyp(urlparse(src).path, urlparse(dest).path)
    return '/static/' + name