Skip to content

Instantly share code, notes, and snippets.

@erny
Last active May 13, 2019 15:16
Show Gist options
  • Save erny/19ee461d2f11a8777a26e656934fdad1 to your computer and use it in GitHub Desktop.
Save erny/19ee461d2f11a8777a26e656934fdad1 to your computer and use it in GitHub Desktop.
Replace django STATIC_URL with {% static %} template tag.
# STATIC_URL must have one space before and one after (or change regex below). URLs must be enclosed with double quotes.
rgrep '{{ STATIC_URL }}' . -l | xargs perl -pi -e 's/"\{\{ STATIC_URL \}\}(.*?)"/"{% static '"'"'\1'"'"' %}"/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment