@chronobserver/htmls
Advanced tools
Comparing version 0.4.4 to 0.4.5
{ | ||
"name": "@chronobserver/htmls", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "HyperText Markup LiveScript!", | ||
@@ -25,4 +25,4 @@ "author": { | ||
"shelljs": "~0.8.5", | ||
"chai": "~4.3.10", | ||
"mocha": "~10.2.0" | ||
"chai": "~4.4.1", | ||
"mocha": "~10.3.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "scripts": { |
@@ -81,6 +81,6 @@ # HTMLS - HyperText Markup LiveScript! | ||
// JavaScript | ||
var htmls = require('@chronobserver/htmls'); | ||
var templateText = 'p "Hello, #@!"'; | ||
var templateFunc = htmls(templateCode); | ||
var html = templateFunc("John Smith"); // <p>Hello, John Smith!</p> | ||
const htmls = require('@chronobserver/htmls'); | ||
const templateText = 'p "Hello, #@!"'; | ||
const templateFunc = htmls(templateText); | ||
const html = templateFunc('John Smith'); // <p>Hello, John Smith!</p> | ||
``` | ||
@@ -93,9 +93,9 @@ | ||
template-func = htmls template-text | ||
html = template-func "John Smith" # <p>Hello, John Smith!</p> | ||
html = template-func 'John Smith' # <p>Hello, John Smith!</p> | ||
``` | ||
## Writing Templates | ||
- You can only use valid HTML5 element names. | ||
- Arguments are accessed via `this` or `@` for short. | ||
- If you want plain text output inside an element, use the `$` function as seen in the example above. | ||
- You should not use HTML5 element names as variable names. | ||
- Arguments are accessed via `this.` or `@` for short. | ||
- Use the `$` function for plain text output inside an element. |
Sorry, the diff of this file is not supported yet
11884