hugopeek / romanesco-patterns

0 stars 0 forks source link

Explore further templating of JSON config files #13

Closed hugopeek closed 8 years ago

hugopeek commented 8 years ago

Right now, some configs for TV's contain a list of templates to which the TV should be assigned. Managing these lists per TV is a nightmare waiting to happen, so templating these lists and maintain them from a central file would be ideal.

A tool that could help here is Jsonnet:

http://jsonnet.org/ https://github.com/yosuke-furukawa/node-jsonnet

It might be able to turn this:

                {
                    "caption": "Call to action (CTA)",
                    "name": "header_cta",
                    "description": "Select the CTA you want to show in the header of this page. This will overwrite all Title settings. You can create CTA's under Content > Global Content > Call To Actions.",
                    "type": "listbox",
                    "category": "Header",
                    "sortOrder": "20",
                    "inputOptionValues": "@CHUNK ctaTVInputOptions",
                    "templates": [
                        "Home",
                        "BasicOverview",
                        "BasicDetail",
                        "Publications",
                        "ArticleTraditional",
                        "ArticleReadability",
                        "ArticleSidenotes",
                        "Homepage",
                        "Basic - Overview",
                        "Basic - Detail",
                        "Publications - Overview",
                        "Article - Traditional",
                        "Article - Readability",
                        "Article - Sidenotes"
                    ]
                }

into something like this:

                {
                    "caption": "Call to action (CTA)",
                    "name": "header_cta",
                    "description": "Select the CTA you want to show in the header of this page. This will overwrite all Title settings. You can create CTA's under Content > Global Content > Call To Actions.",
                    "type": "listbox",
                    "category": "Header",
                    "sortOrder": "20",
                    "inputOptionValues": "@CHUNK ctaTVInputOptions",
                    "templates": [
                        + templates.all +
                    ]
                }