eleventy-plugin-debug
v1.0.0
Published
A collection of debugging filters for Eleventy projects.
Maintainers
Readme
eleventy-plugin-debug
INSTALLATION
npm install pdehaan/eleventy-plugin-debugSETUP
// .eleventy.js
const debug = require("eleventy-plugin-debug");
module.exports = (eleventyConfig) => {
eleventyConfig.addPlugin(debug);
return {};
};This plugin will add the following new global filters which will help with debugging:
inspect— Wrapper for Node's nativeutil.inspect()method.json— Wrapper for JavaScript'sJSON.stringify()method. This filter takes one optional argument which is a string or number value to use for indentation, if you want pretty printed JSON objects.keys— Wrapper for JavaScript'sObject.keys()method. This filter will also sort the returned array of key names for the specified object.
USAGE
Nunjucks
{{ collections.all | inspect }}
{{ page | json }}
{{ page | json(2) }}
{{ page | keys }}LiquidJS
{{ collections.all | inspect }}
{{ page | json }}
{{ page | json: 2 }}
{{ page | keys }}11ty.js
${ this.inspect(data.collections.all) }
${ this.json(data.page) }
${ this.json(data.page, 2) }
${ this.keys(data.page) }
${ this.json(this.keys(data.page), 2) }