{"id":23119533,"url":"https://github.com/njoyce/flask-assetrev","last_synced_at":"2026-04-16T03:31:08.962Z","repository":{"id":66733342,"uuid":"43633136","full_name":"njoyce/flask-assetrev","owner":"njoyce","description":"Flask extension supporting url generation of content hashed static assets.","archived":false,"fork":false,"pushed_at":"2019-06-20T13:37:58.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-17T02:59:35.952Z","etag":null,"topics":["assetrev","flask","grunt","gulp","webpack"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/njoyce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-04T10:46:38.000Z","updated_at":"2019-06-20T13:17:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"b200bf12-f4d5-4b63-b0b8-e212d0d4e1eb","html_url":"https://github.com/njoyce/flask-assetrev","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/njoyce/flask-assetrev","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njoyce%2Fflask-assetrev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njoyce%2Fflask-assetrev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njoyce%2Fflask-assetrev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njoyce%2Fflask-assetrev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/njoyce","download_url":"https://codeload.github.com/njoyce/flask-assetrev/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njoyce%2Fflask-assetrev/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assetrev","flask","grunt","gulp","webpack"],"created_at":"2024-12-17T05:39:09.711Z","updated_at":"2026-04-16T03:31:08.928Z","avatar_url":"https://github.com/njoyce.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Flask-AssetRev\n===============\n\nFlask-AssetRev is a ``Flask`` extension which adds support for mapping\npre-built, content hashed static assets from the source form to the hashed\nversion at runtime.\n\nFor example if your app served a simple script and css file on every page view,\nsuch as:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cscript type=\"text/javascript\" src=\"{{ url_for('static', filename='app.js') }}\u003e\u003c/script\u003e\n    \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"{{ url_for('static', filename='app.css') }}\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\nEverything works perfectly in development and you deploy your app to\nproduction. Users start complaining about errors and you realise that their\nversion of ``app.js`` is being cached somehow out of your control. You decide\nthat content hashing is the way to solve it. You use something like\n``gulp-rev`` to produce the revved assets and move them in to the static\nsub-folder at build time.\n\nBut now the template above doesn't work. Flask-AssetRev solves this problem.\n\nRewriting your template to:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003cscript type=\"text/javascript\" src=\"{{ asset_url('app.js') }}\u003e\u003c/script\u003e\n    \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"{{ asset_url('app.css') }}\u003c/script\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e\n```\n\nUsing the code:\n\n```python\n# app.py\n\nfrom flask import Flask, render_template\nfrom flask.ext import assetrev\n\napp = flask.Flask(__name__)\n\nassetrev.AssetRev(app)\n\n@app.route('/')\ndef index():\n    return render_template('index.html')\n```\n\nWill work for every version of the assets that you deploy.\n\nConfiguration Options\n---------------------\n\n| Name | Description |\n|------|-------------|\n| ``ASSETREV_MANIFEST_FILE`` | The mapping of source to revved asset json file as generated by `gulp-rev` (or similar). It must be within the same directory tree as the main flask app. |\n| ``ASSETREV_BASE_URL`` | The url to find the compiled assets. By default the same host will be used. This allows the assets to be in a completely different domain. |\n| ``ASSETREV_BASE_PATH`` | The directory within which to find the compiled assets in the app's static_folder. |\n| ``ASSETREV_RELOAD`` | Whether to reload the asset manifest per request. By default, this is the same as ``app.config['DEBUG']``. |\n\nDeveloper Guide\n===============\n\nSetting up:\n\n```bash\n# assumes that virtualenvwrapper is installed\n$ mkvirtualenv assetrev\n(assetrev) $ pip install -r requirements_dev.txt\n(assetrev) $ pip install -e .\n```\n\nRunning the tests:\n\n```bash\n(assetrev) $ nosetests\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjoyce%2Fflask-assetrev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnjoyce%2Fflask-assetrev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjoyce%2Fflask-assetrev/lists"}