eleventy-plugin-vento 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +31 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleventy-plugin-vento",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Adds support for the Vento templating language to Eleventy.",
5
5
  "type": "module",
6
6
  "engines": {
package/readme.md CHANGED
@@ -43,6 +43,9 @@ export default function (eleventyConfig) {
43
43
  // A set of filters to load into Vento
44
44
  filters: {},
45
45
 
46
+ // An array of Vento plugins to load
47
+ plugins: [],
48
+
46
49
  // Define whether Javascript Functions should be added
47
50
  // to page data. See below for usage notes on this.
48
51
  addHelpers: true
@@ -57,7 +60,7 @@ export default function (eleventyConfig) {
57
60
  }
58
61
  ```
59
62
 
60
- View the [full list of options](https://vento.js.org/configuration/#options/) to pass as a Vento Configuration object.
63
+ View the [full list of options](https://vento.js.org/configuration/#options/) to pass as a Vento Configuration object (as `ventoOptions`).
61
64
 
62
65
  ## Vento Filters
63
66
 
@@ -66,12 +69,14 @@ Set the `filters` property to an object with methods, these will be loaded as fi
66
69
  Here's an example of defining an `italicize` filter like the example in the Vento documentation:
67
70
 
68
71
  ```js
69
- {
70
- filters: {
71
- italicize(text) {
72
- return `<em>${text}</em>`
73
- }
74
- }
72
+ export default function (eleventyConfig) {
73
+ eleventyConfig.addPlugin(VentoPlugin, {
74
+ filters: {
75
+ italicize(text) {
76
+ return `<em>${text}</em>`;
77
+ },
78
+ },
79
+ });
75
80
  }
76
81
  ```
77
82
 
@@ -83,6 +88,25 @@ And now we can use our filter in a template:
83
88
 
84
89
  See https://vento.js.org/configuration/#filters for more information about filters and how they work.
85
90
 
91
+ ## Vento Plugins
92
+
93
+ If you'd like to extend the Vento library with any plugins, include them in an array passed to the `plugins` option. Here's an example loading the [auto trim](https://vento.js.org/plugins/auto-trim/) plugin:
94
+
95
+ ```js
96
+ import { VentoPlugin } from 'eleventy-plugin-vento';
97
+ import autoTrim, { defaultTags } from 'ventojs/plugins/autotrim_plugin.js';
98
+
99
+ export default function (eleventyConfig) {
100
+ eleventyConfig.addPlugin(VentoPlugin, {
101
+ plugins: [
102
+ autoTrim({
103
+ tags: ['tag', ...defaultTags],
104
+ }),
105
+ ],
106
+ });
107
+ }
108
+ ```
109
+
86
110
  ## JavaScript Helpers
87
111
 
88
112
  Vento can [run arbitrary JavaScript](https://vento.js.org/syntax/javascript/) in templates through its `{{> ...}}` operator, which evaluates at the time the template is run. However, you may want to use Eleventy Shortcodes and Filters in your templates as well.