Last active
May 9, 2023 08:17
-
-
Save rcotrina94/6f401a9454f22b6e23e8 to your computer and use it in GitHub Desktop.
Find and Replace Django static files from template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Find what: | |
`(href|src)="([a-zA-Z0-9/.-]+[^.html])"` | |
Replace with: | |
`$1=\"{% static "assets/$2" %}"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I find it better to replace with single quote ' rather than double quotes " since most HTML templates use the double quotes for the html file here is a modified version
Find what:
(href|src)="([a-zA-Z0-9/.-]+[^.html])"
Replace with:
$1=\"{% static 'assets/$2' %}"
Thanks though