Last Updated: February 25, 2016
·
313
· javierwilson

django template with vim: replace static references in html

Using more elegant option {% static "my_file" %}. See https://docs.djangoproject.com/en/1.8/howto/static-files/

To replace all instances os src="./img/my_image.jpg"...

:%s/src="\.\(.\{-}\)"/src="{% static '\1' %}"/g

To replace all instances os href="./css/my_style.css"...

:%s/href="\.\(.\{-}\)"/href="{% static '\1' %}"/g