Skip to content

Instantly share code, notes, and snippets.

@johnbhartley
Last active September 22, 2015 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnbhartley/c70a72b829856705057f to your computer and use it in GitHub Desktop.
Save johnbhartley/c70a72b829856705057f to your computer and use it in GitHub Desktop.
A quick little way to update HTML code to have all self-closing elements have a trailing slash in Sublime Text 3
# find all image elements replace the end with a trailing slash
find: <img(.*?)>
replace: <img\1 />
# find all input elements replace the end with a trailing slash
find: <input(.*?)>
replace: <input\1 />
# take all instances where extra / was made and trash it
find: / />
replace: />
# saves all the files in case there
# is an unbearable amount to save manually
Opt + Cmd + S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment