A simple template parser.
This is package in WIP
npm install --save tea-parser
# or
yarn add --save tea-parser
With tea-parser
you can parse a file, a filename or each file in template folder.
import { Tea } from 'tea-parser'
Tea(template_file_path, destination_folder_path, data)
// Tea('./template/index.html', './dest', {foo: 'foo', bar: 'bar})
import { Tea } from 'tea-parser'
Tea(template_folder_path, destination_folder_path, data)
// Tea('./template', './dest', {foo: 'foo', bar: 'bar})
To parse the template file, you write your template variable like this:
<!-- HTML Template File -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ site_title }}</title>
</head>
<body>
<p>{{ site_content }}</p>
</body>
</html>
To parse the filename, you can name it like this:
{{filename}}.[ext]
example :
{{template_name}}.json
MIT © AllanCerveaux