@soneknikolaev/ejs-beautify
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

EJS Beautify

Introduction

EJS template beautify library.

Usage

const { beautify } = require("@soneknikolaev/ejs-beautify");

beautify('<div><h2>Hello <%= user.name %>!</h2><%if(links&&links.length>0){%><h3>You received a list of vouchers</h3><%for(var i=0;i<links.length;i++){%><h3><%=links[i]%></h3><%}%><%}%></div>'); /*
<div>
    <h2>Hello
        <%= user.name %>!
    </h2>
    <% if (links && links.length > 0) { %>
        <h3>You received a list of vouchers</h3>
        <% for (var i = 0; i < links.length; i++) { %>
            <h3>
                <%= links[i] %>
            </h3>
        <% } %>
    <% } %>
</div>
*/

beautify('<div><h2>Hello p@= user.name @q!</h2>p@if(links&&links.length>0){@q<h3>You received a list of vouchers</h3>p@for(var i=0;i<links.length;i++){@q<h3>p@=links[i]@q</h3>p@}@qp@}@q</div>', {
    delimiter: "@",
    openDelimiter: "p",
    closeDelimiter: "q"
});
/*
<div>
    <h2>Hello
        p@= user.name @q!
    </h2>
    p@ if (links && links.length > 0) { @q
        <h3>You received a list of vouchers</h3>
        p@ for (var i = 0; i < links.length; i++) { @q
            <h3>
                p@= links[i] @q
            </h3>
        p@ } @q
    p@ } @q
</div>
*/

Package Sidebar

Install

npm i @soneknikolaev/ejs-beautify

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

161 kB

Total Files

12

Last publish

Collaborators

  • soneknikolaev