M
M
MaksimLav2019-01-24 09:55:01
git
MaksimLav, 2019-01-24 09:55:01

How to update the frontend on an existing project?

Essence of the question:
There is a layout developed on a local machine, associated only with the repository of this layout on github. As the main work on it is finished, I pass it on to the person who pulls the layout on the CMS, for example, this is the original version: the
original html located in the layout repository The code is already on the project server, tied to the CMS: Let's say I changed my file by adding the h2 tag and now it looks like this:
<h1>Привет</h1>
<h1>{какой то скрипт заполнения}</h1>

<h1>Привет</h1>
<h2>Пример</h2>

How to link changes in the html file to the php file to get something similar in the output?
<h1>{какой то скрипт заполнения}</h1>
<h2>Пример</h2>

At the moment, the person pulling on the CMS manually, looks at the changes by commits, and adds them to himself in the php file.
How to automate this? I do not ask for a ready-made solution, only general thoughts on where to dig and what to read.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sanes, 2019-01-24
@Sanes

If there is a CMS, then there must be a theme or view files.
Make a new theme or view and switch. Ideally, the path should change in one place.

S
Sergey Levchenko, 2019-01-24
@nuykon

As I understand it, you write html manually (have you heard about template engines and preprocessors)?
Make a builder using gulp/webpack/nodejs, which for example will build a php/tpl/twig/blade file along with html.
For example, I use pug template engine, webpack collects html from it, css is collected from stylus / less / sass, if necessary, I use a plugin or a self-written script that renames html to php, for example, or creates a copy and renames it (not manually, all scripts).
If you do not want to master all these tools, then you can try this - https://github.com/pug-php/pug, you will write pug templates instead of html, and the backender will work with them.
Another option is to make the frontend SPA, communicate with the backend via the JSON API, in which case the backender does not need to bother with templates at all (neither php, nor html) and you do not need to go into php (backend)

I
ipokos, 2019-01-24
@ipokos

1st option. You are doing layout for a project. those. you deploy your project and work in your branch. This is then merged with the release or master branch. Changes are pulled automatically.
2nd option. There is a project repository. You make a theme in a separate (your) repository. those. it has nothing to do with the project. Then the standard process of "stretching" the topic is by hand.

J
Jupiter Max, 2019-01-24
@vardoLP

probably not, the person will see the commits in them, what and where has changed. Well, then it will change in the project.

A
Alexey, 2019-01-24
@skazi_premiere

You have a CMS and it is not clear which specific theme files need to be changed without human intervention.
The logic seems to be simple, link file lines to each other and when changing HTML, you can analyze it with the previous version and append only new lines to php based on existing links.

A
Alexey Laud, 2019-01-24
@kshshe

Automatically and having only the original layout - no way. The files will differ too much, it will not work to navigate by line numbers (there may be a banal cycle that displays a list of elements, this is no longer similar to the original version). If you are ready to understand a little, you can ask you to install a local copy of the project already with CMS and show you where the templates are and edit them right away.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question