Project Docs Github
Log in
ittf site docs concepts t ittfdocuments pathresolution.html.ittf Edit
  • /ittf/site/docs/concepts/t/ittfdocuments/pathresolution.html.ittf

/ittf/site/docs/concepts/t/ittfdocuments/pathresolution.html.ittf (primary)

edit
                                            
1 concept Path resolution of composed documents
2 summary
3 p The path resolution algoritm for retrieving mixed and included ittf fragments starts from the
4 + composer node.
5 + The folder uri, of the document containing the composer node, gives the base path.
6 + The node value of the mix or include command gives the relative path.
7 p At first is searched the path resulting from joining base and relative path using the
8 + nodejs function path.resolve(...).
9 p If this match fails, then the 't' folder rule is applied, starting from the base path
10 + and going down one step first, and then going up on the folder tree. The rule is
11 + the same followed by nodejs to locate packages. The wizzi factory uses
12 + folders named 't' as nodejs uses folders named 'node_modules'.
13 p The search for a composed document proceeds as follow:
14 ul
15 li search path.resolve(base-path, relative-path)
16 li search path.resolve(base-path, 't', relative-path)
17 li search path.resolve(path.dirname(base-path), 't', relative-path)
18 li search path.resolve(path.dirname(path.dirname(base-path)), 't', relative-path)
19 li ...
20 p until the document is found or the base-path of the wizzi factory repository, declared
21 + in the config file, is reached. In the last case the search fails and we
22 + have an IttfNotFound error.
23 p Example. Given this folder structure
24 ittf
25 - folder-a
26 - t
27 - layouts
28 - site-layout.html.ittf
29 - folder-a1
30 - t
31 - dialog.html.ittf
32 - my-home-page.html.ittf
33 p The ITTF Document my-home-page.html.ittf could contain these two composition commands:
34 ittf
35 - layouts/site-layout( home )
36 - $include dialog( )
37 p For both commands the base-path is 'folder-a/folder-a1'.
38 p For the $include command the relative path is 'dialog.html.ittf' and the
39 p document is found by: path.resolve(base-path, 't', relative-path).
40 p For the mix command the relative path is 'layouts/site-layout' and the
41 p document is found by: path.resolve(path.dirname(base-path), 't', relative-path).
Save
Save & Refresh
Cancel