1.0.3 • Published 4 months ago

prettier-plugin-ejs v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Prettier Plugin for EJS

This plugin formats EJS markup in html files. It uses the default html parser and just marks EJS specific tags as comments.

Installation

npm install --save-dev prettier-plugin-ejs

For Prettier v2, the plugin will be loaded automatically.

For Prettier v3, you'll need to manually load the plugin:

prettier --plugin=prettier-plugin-ejs --write .

Please check Prettier Docs for other loading methods.

Example

Before

<div>
  <!-- prettier-ignore -->
  <div>
    <% if (condition) { %> <% } else if (condition) { %> <% } %>
  </div>

  <div class="<%= red %>"><%= 1 > 0 %></div>

  <textarea><%= text %></textarea>
  <code><%= text %></code>
  <pre><%= text %></pre>
</div>

After

<div>
  <div>
    <% if (condition) { %>
    <% } else if (condition) { %>
    <% } %>
  </div>

  <div class="<%= red %>"><%= 1 > 0 %></div>

  <textarea><%= text %></textarea>
  <code><%= text %></code>
  <pre><%= text %></pre>
</div>

Nested Tag

<td <% if (styleData) { %>
  style="<%= styleData %>" <% } %>>
  <%= data %>
  <%= data %>
</td>

Note

Tags which contains the greater then symbol > are ignored.

1.0.2

4 months ago

1.0.3

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.0.19

4 months ago

0.0.16

8 months ago

0.0.17

8 months ago

0.0.18

7 months ago

0.0.11

10 months ago

0.0.12

10 months ago

0.0.13

9 months ago

0.0.14

9 months ago

0.0.15

9 months ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago