- Stable
3.1.5- Canary
4.0.0-alpha.7
- Guide
Guide
- Get Started
- Command Line Usage
- Add a Configuration File
- Copy Files to Output
- Add CSS, JS, Fonts
- Importing Content
- Configure Templates with Data
- Using Data in Templates
- Template Languages
- Template Features
- Environment Variables
- Internationalization (i18n)
- Watch Files and Dev Servers
- Common Pitfalls
- Advanced
- Plugins
- Services
log Universal Filter
An easy way to console.log anything from inside of a template file.
{{ "My Title" | log }}
{{ "My Title" | log }}
export default function (data) {
// Caveat: you have access to `console.log` here, so probably use that.
return this.log("My Title");
};
module.exports = function (data) {
// Caveat: you have access to `console.log` here, so probably use that.
return this.log("My Title");
};
is functionally the same as running console.log("My Title") inside of your template.
Using log in filter chains Added in v2.0.0
You can drop log in between any filter chain you already have and it will log the incoming data and pass it through to the next filter.
Syntax Liquid
{{ "My Title" | log | upcase }}
This is the same as:
{% assign temp = "My Title" %}
{{ temp | log }}
{{ temp | upcase }}
Syntax Nunjucks
{{ "My Title" | log | upper }}
This is the same as:
{% set temp = "My Title" %}
{{ temp | log }}
{{ temp | upper }}
← Back to Filters documentation.