Last Updated: February 25, 2016
·
401
· 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="http://coderwall.com/img/my_image.jpg"...

:%s/src="http://coderwall.com/(./%7B-%7D/)"/src="http://coderwall.com/%7B%%20static'\1' %}"/g

To replace all instances os href="http://coderwall.com/css/my_style.css"...

:%s/href="http://coderwall.com/(./%7B-%7D/)"/href="http://coderwall.com/%7B%%20static'\1' %}"/g