Answer the question
In order to leave comments, you need to log in
How do you edit a large number of site pages with monotonous code?
Let's say there is a site with a bunch of pages and subpages, menus and lists with files like id*.html(id1.html,id2.html,id3.html).
It is necessary to change these names and so on, at the moment I use Text Raplacer and a banal find-replace from sublime.
It seems very interesting to work with Linux commands through the terminal, there is a wider toolkit there.
What do you use for these purposes?
UPD Pull out the code of one menu and change it to include the file will not work, although the menu works the same way, but
in the code on one page there is a space here and there, but not on the other, so find and replace does not work.
PS!!! THE CODE IS NOT MY, THEY GIVE IT TO ME ONLY FOR EDIT
Answer the question
In order to leave comments, you need to log in
If several pages have the same code, something in the conservatory is wrong and needs to be corrected. Template engines will save the father of Russian democracy - smarty, blade, twig (php) jade, handlebars (js). For styles preprocessors less, stylus, sass. To build the front, use builders (tars, webpack, elixir, your own gulp-lisaped, etc., whichever is more appropriate). Then you don't have to ask these questions. One of the main development rules is "The same piece of code should be written only once"
Before using commands, you should master the magic of backup!
And the magic of the git, so that in case of problems to roll back
Find the phrase in the directory and subdirectories regardless of the case
$ grep -ir "some shit code" ./
./filepath1: Some shit code
./filepath2: SoMe Shit code
sed -i.bak s/Some shit code/Some code/g *
In the same sublime there is Find in folder (it seems to be called something like that), there is also a text replacement.
If you are interested in a console solution, then read about sed .
Monotonous code should be placed in one file or database... Then there will be no such problems...
jade-lang.com
Each block is a separate file.
Let's say the header.jade file is the same for all pages, changing the text in the topics to the required one - it will change in all pages.
PS - I saw that in the existing code, the replacement should be carried out. Then yes, search with replacement.
Use some IDE ... From free Netbeans, then you'll appreciate it. The main thing is that if you undertook to study the instrument, study it, otherwise you will abandon it once and for all. There is such a thing as refactoring, convenient work with replacements. Plus, if the layout is large, such things as a header, header, footer, sidebar and all the same elements can be included in the form of php, it helps a lot if you need a really large layout.
Dmitry has a good answer, I support
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question