it"s a bit redundant to write every page once. How do you usually solve this problem?
it"s a bit redundant to write every page once. How do you usually solve this problem?
what technology stack do you use? Different technical solutions don't make sense at all?
you can try gulp + gulp-ejs (or other template engine). Split the reused code into fragments, then piece together fragments on different pages like <% include.. / public/header.ejs% >
, and finally build a HTML page using gulp.
several methods introduced in the public part of the summary page
if the Vue is useful, pull it out directly to make a public component, and quote it directly
you can extract the same part as a separate template file.
introduce special tags such as < tpl id= "footer" / >
parse the html tag through js, get the id, of tpl and send a request to get the template file according to this id, and then replace the tag with template content
pjax
to learn about it.
extract the parts that may be reused and write them as common components
which page needs to be import and then define it in components
met before, small company,
iframe
, but bug is more obvious. when I was developing, I still used iframe
, but before launching, I extracted the code and put it in a separate js, such as
http://liuxiaojun.win/2019/01.