eleventy-plugin-vento 2.0.0-beta.1 → 2.0.0-beta.2
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.
- package/VentoPlugin.js +16 -5
- package/package.json +1 -1
- package/readme.md +2 -2
- package/test/input/directory-data/dir-data.vto +6 -0
- package/test/input/directory-data/directory-data.11tydata.json +3 -0
- package/test/input/eleventy.config.js +1 -1
- package/test/input/permalinks.vto +7 -0
- package/test/input/root.vto +6 -0
- package/test/input/with-shortcodes.vto +1 -1
package/VentoPlugin.js
CHANGED
|
@@ -69,15 +69,13 @@ export function VentoPlugin(eleventyConfig, options = {}) {
|
|
|
69
69
|
// Add autotrim plugin if enabled
|
|
70
70
|
if (options.trimTags) env.use(autoTrim({ tags: options.trimTags || ventoDefaultTrimTags }));
|
|
71
71
|
|
|
72
|
-
eleventyConfig.on('eleventy.before', () => {
|
|
73
|
-
env.cache.clear();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
72
|
// Add vto as a template format and create a custom template for it
|
|
77
73
|
eleventyConfig.addTemplateFormats('vto');
|
|
78
74
|
eleventyConfig.addExtension('vto', {
|
|
79
75
|
outputFileExtension: 'html',
|
|
76
|
+
|
|
80
77
|
async compile(inputContent, inputPath) {
|
|
78
|
+
env.cache.clear();
|
|
81
79
|
return async (data) => {
|
|
82
80
|
if (options.addHelpers) {
|
|
83
81
|
// Extract a possible namespace from the addHelpers option
|
|
@@ -98,8 +96,21 @@ export function VentoPlugin(eleventyConfig, options = {}) {
|
|
|
98
96
|
else data = { ...data, ...helperFunctions };
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
const result = await env.runString(inputContent, data, inputPath);
|
|
100
|
+
|
|
101
|
+
return result.content;
|
|
102
102
|
};
|
|
103
103
|
},
|
|
104
|
+
|
|
105
|
+
compileOptions: {
|
|
106
|
+
permalink(linkContents, inputPath) {
|
|
107
|
+
console.log(linkContents);
|
|
108
|
+
if (!linkContents) return linkContents;
|
|
109
|
+
return async (data) => {
|
|
110
|
+
const result = await env.runString(linkContents, data, inputPath);
|
|
111
|
+
return result.content;
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
},
|
|
104
115
|
});
|
|
105
116
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -5,7 +5,7 @@ An [Eleventy](https://11ty.dev/) plugin that adds support for [Vento](https://ve
|
|
|
5
5
|
[Installing](#installing)<br>
|
|
6
6
|
[Usage](#usage)<br>
|
|
7
7
|
[Plugin Options](#plugin-options)<br>
|
|
8
|
-
[
|
|
8
|
+
[Filters](#filters)<br>
|
|
9
9
|
[Vento Plugins](#vento-plugins)<br>
|
|
10
10
|
[Auto-Trimming Tags](#auto-trimming-tags)<br>
|
|
11
11
|
[JavaScript Helpers](#javascript-helpers)<br>
|
|
@@ -49,7 +49,7 @@ export default function (eleventyConfig) {
|
|
|
49
49
|
addHelpers: true,
|
|
50
50
|
|
|
51
51
|
// Define tags that should be trimmed, or set to true
|
|
52
|
-
// to trim the default tags
|
|
52
|
+
// to trim the default tags (see section on Auto-trimming)
|
|
53
53
|
trimTags: [],
|
|
54
54
|
|
|
55
55
|
// A Vento configuration object
|
|
@@ -19,5 +19,5 @@ export default async function (eleventyConfig) {
|
|
|
19
19
|
trimTags: [...ventoDefaultTrimTags, 'for'],
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
eleventyConfig.addShortcode('possumPosse', () =>
|
|
22
|
+
eleventyConfig.addShortcode('possumPosse', (number = 'the') => `Release ${number} possums!!!`);
|
|
23
23
|
}
|