et-string
v0.0.2
Published
Basic string template for et-tempate.
Downloads
5
Readme
et-string
Desription
It is the basic template for et-template.
It tranlsate the templete string to a function-string to assemble et-template
Usage
The templete string.
var _ = require('lodash');
if (it.length > 1) {
<% It just has so many items. %>
} else if (it.length === 1) {
<% It just has one item. %>
} else {
<% It is empty list; %>
}
The result string.
var _ = require('lodash');
exports.template = function (it) {
var result = '';
if (it.length > 1) {
result += ` It just has so many items. `;
} else if (it.length === 1) {
result += ` It just has one item. `;
} else {
result += ` It is empty list; `;
}
return result;
}
Just replace '<%' and '%>' to es6 teamplte then finish the et-string.
Attention
- Do not use es6 template literals ` in et-string.
- Use require to import dependecies and write on the header of codes.
License
MIT