htmlvue.jswebstormstructural-search

Replace HTML tag based on attribute value


I need to replace vanilla <a> tag by different tag (<router-link>) in whole project. The main problem is to do it with some conditions based on href value (e.g. it should ignore href with "#").

I wrote regex, but it was really massive and sometimes cause issues.


Solution

  • After some research I found that webstorm(and other) has "Structural Replace" feature which help with it. I create follow structural replace: enter image description here enter image description here Main poins: