Skip to content
PluginStats

prettier-plugin-nunjucks weekly downloads statistics

By Poliklot (3 listings) · npm · Prettier plugins

Prettier plugin for Nunjucks templates (.njk, .nunjucks, .nunj)

View on npm Fresh · Dec 6, 2026

prettier-plugin-nunjucks has 788 recorded weekly downloads on npm, a decrease of 4.8% over the past 30 days, ranking #2146 of 3,247 tracked listings.

Weekly downloads
788
Official API · Dec 5, 2026
7-day growth
+61.5%
+300 weekly downloads
30-day growth
-4.8%
-40 weekly downloads
90-day growth
+83.3%
+358 weekly downloads
Rank
#2146
▲ 22 in 7 days

About prettier-plugin-nunjucks

prettier-plugin-nunjucks

npm version

Prettier plugin for HTML-heavy Nunjucks templates.

It formats .njk / .nunjucks / .nunj files with stable, idempotent output and keeps Nunjucks statement tags, variables, comments, whitespace-control markers, and raw/verbatim blocks in the Nunjucks syntax instead of treating them as Handlebars or generic HTML.

Install

npm install --save-dev prettier prettier-plugin-nunjucks

Quick Start

Recommended config:

/** @type {import("prettier").Config} */
module.exports = {
  plugins: ["prettier-plugin-nunjucks"],
  overrides: [
    {
      files: ["*.njk", "*.nunjucks", "*.nunj"],
      options: {
        parser: "nunjucks",
      },
    },
  ],
};

The explicit override makes editor format-on-save deterministic, especially in projects that mix HTML, Nunjucks, Jinja-like templates, and other Prettier plugins.

Configuration Patterns

1. Minimal plugin setup

Use this only after verifying your Prettier/editor resolves .njk files to this plugin.

/** @type {import("prettier").Config} */
module.exports = {
  plugins: ["prettier-plugin-nunjucks"],
};
2. Explicit Nunjucks override

Use this for shared projects and CI.

/** @type {import("prettier").Config} */
module.exports = {
  plugins: ["prettier-plugin-nunjucks"],
  overrides: [
    {
      files: ["src/**/*.{njk,nunjucks,nunj}"],
      options: {
        parser: "nunjucks",
      },
    },
  ],
};
3. Projects with Nunjucks in HTML files

If your project stores Nunjucks templates as .html, force the parser for those paths.

{
  "plugins": ["prettier-plugin-nunjucks"],
  "overrides": [
    {
      "files": ["views/**/*.html", "templates/**/*.html"],
      "options": { "parser": "nunjucks" }
    }
  ]
}
4. Project style options

Normal Prettier options still apply.

/** @type {import("prettier").Config} */
module.exports = {
  plugins: ["prettier-plugin-nunjucks"],
  overrides: [
    {
      files: ["**/*.{njk,nunjucks,nunj}"],
      options: {
        parser: "nunjucks",
        printWidth: 100,
        tabWidth: 2,
        singleQuote: true,
        htmlWhitespaceSensitivity: "ignore",
      },
    },
  ],
};
5. Local plugin path during dogfooding

Useful before publishing a new npm version.

/** @type {import("prettier").Config} */
module.exports = {
  plugins: ["../prettier-plugin-nunjucks/dist/plugin.js"],
  overrides: [
    {
      files: ["**/*.{njk,nunjucks,nunj}"],
      options: {
        parser: "nunjucks",
      },
    },
  ],
};
Text wrapping

Normal HTML text wraps at word boundaries to respect printWidth, including the available width after indentation. Nunjucks variables stay intact, and words or punctuation glued to them stay glued. proseWrap does not control HTML text wrapping, just as with Prettier's HTML printer.

printWidth is a target, not a hard limit: unbreakable words, template expressions, and whitespace-sensitive content such as pre, textarea, and raw/verbatim blocks may remain longer than it.

Text and inline variables wrap as one text flow inside HTML block elements such as p and div, Nunjucks block bodies, and the template root. Configured inlineTags participate in the same flow. Existing line breaks in ordinary text do not force variables onto separate lines or disable wrapping. Actual inline HTML elements such as a and span retain their significant tag boundaries.

classAttributeLayout

Control whether class attribute values may use multiple physical lines. The default auto mode preserves the existing formatting rules. Use single-line to keep static and conditional class values on one line; the surrounding HTML tag may still wrap.

DefaultCLI OverrideAPI Override
"auto"--class-attribute-layout <auto|single-line>classAttributeLayout: "auto" | "single-line"
{
  "plugins": ["prettier-plugin-nunjucks"],
  "classAttributeLayout": "single-line"
}
Custom extension tags

Nunjucks extensions can define project-specific tags. Unknown single statement tags are preserved by default; tags that behave like blocks or branches can be configured explicitly.

/** @type {import("prettier").Config} */
module.exports = {
  plugins: ["prettier-plugin-nunjucks"],
  overrides: [
    {
      files: ["**/*.{njk,nunjucks,nunj}"],
      options: {
        parser: "nunjucks",
        blockTags: ["remote"],
        forkTags: ["error"],
      },
    },
  ],
};

Input:

{% remote "/stuff" %}
  This content will be replaced with the content from /stuff
      {% error %}
            There was an error fetching /stuff
          {% endremote %}

Output:

{% remote "/stuff" %}
  This content will be replaced with the content from /stuff
{% error %}
  There was an error fetching /stuff
{% endremote %}

CLI

Published package:

npx prettier --write "src/**/*.{njk,nunjucks,nunj}" --plugin prettier-plugin-nunjucks --parser nunjucks

Local plugin build:

npx prettier --write "src/**/*.{njk,nunjucks,nunj}" --plugin ../prettier-plugin-nunjucks/dist/plugin.js --parser nunjucks

API

const prettier = require("prettier");
const plugin = require("prettier-plugin-nunjucks");

async function run(source) {
  return prettier.format(source, {
    filepath: "template.njk",
    parser: "nunjucks",
    plugins: [plugin],
  });
}

What The Plugin Handles Today…

Description from the npm listing.

  • prettier
  • prettier-plugin
  • nunjucks
  • njk
  • jinja
  • html
  • formatter
  • eleventy
  • 11ty

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

prettier-plugin-nunjucks weekly downloads on npm, last 90 days: 788 weekly downloads as of Dec 5, 2026, +83.3% over 90 days.prettier-plugin-nunjucksWeekly downloads on npm · Last 90 days788downloads / week+83.3% over 90 days02004006008001K1.2KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
prettier-plugin-nunjucks weekly downloads on npm, last 90 days: 788 weekly downloads as of Dec 5, 2026, +83.3% over 90 days.

7/30/90-day growth

prettier-plugin-nunjucks weekly downloads growth on npm: +61.5% over 7 days, -4.8% over 30 days, +83.3% over 90 days.prettier-plugin-nunjucksWeekly downloads growth on npm788downloads / week now7-day growth+300 weekly downloads+61.5%30-day growth-40 weekly downloads-4.8%90-day growth+358 weekly downloads+83.3%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-nunjucks weekly downloads growth on npm: +61.5% over 7 days, -4.8% over 30 days, +83.3% over 90 days.

Ranking history

prettier-plugin-nunjucks npm ranking history: currently #2146 (by weekly downloads).prettier-plugin-nunjucksnpm ranking · by weekly downloads · Last 90 days#2146current rank#1500#1600#1700#1800#1900#2000#2100#2200Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-nunjucks npm ranking history: currently #2146 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 108, #6 (overall #2,146)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 3, #6 (overall #46)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (170)
Recent weekly downloads observations for prettier-plugin-nunjucks
Date (UTC)Weekly downloadsChange vs. previous
788+38
750-12
762+51
711+98
613-15
628+126
502+14
488-31
519-85
604-77
681-30
711-257
968-60
1,028—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-nunjucks alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/prettier-plugin-nunjucks. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.