D
D
Dionid2014-09-16 01:36:21
HTML
Dionid, 2014-09-16 01:36:21

What tool (like grunt) allows you to collect html from other html files?

After reading a lot of material on the subject of the BEM methodology, as well as a long work on the site, the design of which changes exactly in those places that are found on each page, there was a need for a technology for assembling the main html files (index.html, www/portf/*. html), by including other html files in them, each of which is a self-sufficient set of elements.
Approximately according to this technology, this should be implemented (I describe the concept from my head):
Each individual module (site element, for example: <div id="menuWR"> <ul> ...</ul> </div>) is located in a separate folder with all its own js and css (that is, jq, which is used in all folders, is connected from the root file ) and get something like this path from the root file: "modules/menu/menu.html menu.js menu.css".
Index.html is a file that specifies where and what to include from external files (for example:

<nav> import("modules/menu/menu.html", "#menuWR")</nav>
)
After that, the assembly takes place and the output is a ready-made index.html file, inside of which are all the elements taken from the modules (index.html example after assembly: <nav> <div id="menuWR"><ul> ...</ul> </div></nav>)
That is, the entire assembly takes place on the developer’s computer and the output is absolutely ready html files.
I can imagine (but can't find) such an implementation on grunt, but maybe there are other ways to do it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2014-09-16
Protko @Fesor

https://www.npmjs.org/package/gulp-file-include
https://github.com/vanetix/grunt-includes

D
Dionid, 2014-09-16
@Dionid

Thank you.
I also found grunt-bake, which is already good, BUT: it needs to not easily merge files, it needs to be able to isolate a certain element from the page and add it exactly (perhaps your options have such a function, but I I do not see)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question