I have a folder of static files (html, css and js) and I recognised a piece of code (say, a dinosaur animation) that I want to transport to another folder of static files (a separate project of my own based on a different template).(我有一个静态文件文件夹(html,css和js),并且我识别了一段代码(例如,恐龙动画),我想将该代码传输到另一个静态文件文件夹(基于不同的我自己的独立项目)模板)。)
The main question is what is the correct and efficient way to do this.(主要问题是执行此操作的正确和有效方法是什么。) This is my current process:(这是我当前的过程:)
Manually recognise the minimal(手动识别最小)
html chunk where this piece is displayed ( div class="dinosaur_animation" ... )(显示此片段的html块( div class =“ dinosaur_animation” ... ))
css part where the classes are declared ( .dinosaur_animation { ... )(声明类的CSS部分( .dinosaur_animation {... ))
js scripts needed(所需的js脚本)
Manually copy these pieces to the html, css and js sources of my new project.(手动将这些片段复制到新项目的html,css和js源中。)
Rename the original class and function names (all instances of "dinosaur_animation" renamed to "dinosaur_animation_newproj" ) as is frequently the case that there is conflict with classes and functions using the same name in the new project.(重命名原始的类和函数名称(将“ dinosaur_animation”的所有实例重命名为“ dinosaur_animation_newproj” ),就像在新项目中使用相同名称的类和函数经常发生冲突的情况一样。)
I have successfully transported the pieces from one template to another using this process a couple time, but I am aware that it is extremely inefficient and there should be a smarter way of doing this.(我已经使用此过程成功地将片段从一个模板传输到了另一个模板,但是我知道它效率极低,并且应该有一种更聪明的方式来实现。) For lack of terminology knowledge, I also couldn't google properly.(由于缺乏术语知识,我也无法正常使用Google。)
Could you kindly give a step by step of a smarter way of doing this?(您能逐步给出一个更明智的方法吗?)
As extra points, can you help me to express what I have just described using correct terminology and antecipate if I can do the same if I am using Wordpress rather than handling static files directly?(另外,您是否可以使用正确的术语来表达刚才描述的内容,并确定如果我使用Wordpress而不是直接处理静态文件,是否可以做同样的事情?) As everything seems to be wrapped into php and changing original files is regarded as a bad idea, I presume the answer is no...(由于所有内容似乎都包裹在php中,并且更改原始文件被认为是一个坏主意,所以我想答案是否定的。)
Thanks!(谢谢!)
ask by Jimmy translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…