ReactY Templator - Yaml based templating for ReactJS
Create dynamic page content using YAML and Markdown
Installation
npm install --save react-yaml-templator
Basic usage
Folder structure
.
├── public/
│ ├── pages/
│ │ ├── index.yml
│ │ ├── base.yml
│ │ └── about.yml
│ └── static/
│ ├── css/
│ ├── js/
│ └── index.html
└── index.js
index.js
var Reacty = ;var path = ;var express = ; var app = ;var pages = path; app;
index.html
$body-placeholder
Template Examples
Navigation Bar
- !navbar items: - "Home": '/' - "All kinds of links": 'https://example.com' - "Here's a link": '#on-page-link'
Renders as
Home All kinds of links Here's a link
Section
- !section id: first title: '# First!' class: row items: - !col id: maybe-col content: | ## Here is a column - !col id: maybe-col-also content: | ## Here is another column You can add images and tables in here, too. from adam-p/markdown-here | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is | right-aligned | $1600 |
Renders as
First! Here is a column Here is another column You can add images and tables in here, too. from adam-p/markdown-here ...
Template Referencing
top_template:- !get 'another-template.yml'
Loads the content of the referenced Yaml file. Good for content reuse, keeping file sizes smaller, and keeping similar collections of information together.
Modules
Custom defined types that you inject with Yaml tags.
Example (not included in default modules):
top_slideshow:- !slideshow items: - 'https://example.com/img1.png' - 'https://example.com/img2.png' - 'https://example.com/img3.png'