4.1.0 • Published 3 months ago
@scaffdog/core v4.1.0
@scaffdog/core
@scaffdog/core
is a low layer of scaffdog.
Install
Install via npm:
$ npm install @scaffdog/core
Usage
template.md:
# Variables
- key: `{{ input | upper }}`
# `{{ input }}.txt`
```
{{ output.path }}
```
index.ts:
import fs from 'fs';
import path from 'path';
import { createContext, compile } from '@scaffdog/engine';
import { extract } from '@scaffdog/core';
const source = fs.readFileSync('template.md', 'utf8');
const context = createContext({});
const { variables, templates } = extract(source, context);
for (const [key, ast] of variables) {
context.variables.set(key, compile(ast, context));
}
for (const template of templates) {
const filename = compile(template.filename, context);
const data = compile(
template.content,
extendContext({
variables: new Map([
[
'output',
{
path: filename,
},
],
]),
}),
);
fs.writeFileSync(filename, data);
}
// --> Generated "path/to/scaffdog.txt"
4.1.0
3 months ago
4.0.0
8 months ago
3.0.0-canary.1
1 year ago
3.0.0-canary.0
1 year ago
3.0.0
1 year ago
2.5.1
1 year ago
2.5.0-canary.0
2 years ago
2.5.0-canary.1
2 years ago
2.5.0-canary.2
2 years ago
2.5.0-canary.3
2 years ago
2.5.0
2 years ago
2.3.0
2 years ago
2.2.0
2 years ago
2.1.1
2 years ago
2.4.0
2 years ago
2.3.1
2 years ago
2.4.0-canary.0
2 years ago
2.1.0
2 years ago
1.2.1-canary.0
3 years ago
2.0.0-canary.7
2 years ago
2.0.0-canary.4
2 years ago
2.0.0-canary.3
2 years ago
2.0.0-canary.6
2 years ago
1.5.0
2 years ago
1.4.0
3 years ago
1.3.0
3 years ago
2.0.3
2 years ago
2.0.2
2 years ago
2.0.1
2 years ago
1.2.1-canary.1
3 years ago
2.0.0
2 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.1.0-canary.0
3 years ago
1.0.1-canary.0
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
1.0.0-canary.8
4 years ago
1.0.0-canary.7
4 years ago
1.0.0-canary.6
4 years ago
1.0.0-canary.5
4 years ago
1.0.0-canary.4
4 years ago
1.0.0-canary.3
4 years ago
1.0.0-canary.2
4 years ago
1.0.0-canary.1
4 years ago
1.0.0-canary.0
4 years ago