postxml-repeat
v0.2.0
Published
PostXML plugin for repeating elemetns
Downloads
4
Readme
postxml-repeat
PostXML plugin for repeating elemetns.
Installation
npm i postxml-repeat --save-dev
Usage
Example 1
Input
<div class="component">
<div class="component__element" repeat="3">Hi!</div>
</div>
Output
<div class="component">
<div class="component__element">Hi!</div>
<div class="component__element">Hi!</div>
<div class="component__element">Hi!</div>
</div>
Example 2 (Array)
You can use template string syntax when repeat array (value, key).
Input
<div class="component">
<div class="component__element" repeat="['A', 'B', 'C']">${value}</div>
</div>
Output
<div class="component">
<div class="component__element">A</div>
<div class="component__element">B</div>
<div class="component__element">C</div>
</div>
Licence
MIT