Created
March 4, 2020 16:21
-
-
Save zaiste/5378fafa0bfc7c6fefa50f810dd9a3ac to your computer and use it in GitHub Desktop.
Fun with Pure Engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { compile } = require('pure-engine') | |
const escape = require('escape-html') | |
const fs = require('fs-extra'); | |
async function example() { | |
const content = await fs.readFile('./index.html'); | |
const { template } = await compile(content.toString()) | |
console.log(template({ foo: 'bar' }, escape)) | |
} | |
example() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<!-- --> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<import layout from="./default.html" /> | |
<layout> | |
<h1>Hello, world!</h1> | |
<form> | |
<input name="foo" /> | |
<button>Submit</button> | |
</form> | |
</layout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment