Since it is a front-end, you can use node to write a script, loop through each file in the directory, and use regular expressions to replace it
So it is to read the file content in a loop, find the content, extract this content, replace, update and save, it doesn’t matter what language is used
PS: If you had maintained good code organization habits before, this problem would not have occurred. For example, the top navigation was made into a fragment and introduced where needed. In this way, you only need to modify one place in the future, so When you find that you are reusing a long section of code, it is best to split it into a separate file
Since it is a front-end, you can use node to write a script, loop through each file in the directory, and use regular expressions to replace it
So it is to read the file content in a loop, find the content, extract this content, replace, update and save, it doesn’t matter what language is used
PS: If you had maintained good code organization habits before, this problem would not have occurred. For example, the top navigation was made into a fragment and introduced where needed. In this way, you only need to modify one place in the future, so When you find that you are reusing a long section of code, it is best to split it into a separate file
A text editor is enough. It is the software that replaces the native text editor under win
Shouldn’t the same code reference the same template?
sublime
Sublime Text full text search regular replacement
I simply wrote a loop replacement script, I hope it can help you.
You need to use nodejs.
Install Node.js
The code is as follows,
filesArr
is the file array that needs to be replaced, andXXX
is your newly modified code: