Skip to content

Commit c387f76

Browse files
committed
docs: add 11ty 3+ config setup
1 parent f709ac4 commit c387f76

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

DOCUMENTATION.md

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515

1616
## Installation
1717

18-
> ⚠ This plugin relies on the new `eleventyConfig.addGlobalData` method that comes with Eleventy `1.0.0`, [see documentation](https://www.11ty.dev/docs/data-global-custom) for more.
19-
>
20-
> To use it, make sure you use Eleventy `1.0.0` or above:
21-
>
22-
> - With npm: `npm install --save-dev @11ty/eleventy@^1.0.0`;
23-
> - Yarn: `yarn add --dev @11ty/eleventy@^1.0.0`;
24-
> - Or npx: `npx @11ty/eleventy@^1.0.0`.
18+
> ⚠ This plugin relies on the new `eleventyConfig.addGlobalData` method that cmae with Eleventy `1.0.0`, [see documentation](https://www.11ty.dev/docs/data-global-custom) for more.
2519
2620
Add `eleventy-plugin-prismic` dependency to your project:
2721

@@ -33,6 +27,42 @@ $ yarn add --dev eleventy-plugin-prismic
3327

3428
Then open up your Eleventy config file (probably `.eleventy.js`) and use the `addPlugin` method:
3529

30+
<details>
31+
32+
<summary>11ty 3+ ESM Version</summary>
33+
34+
```javascript
35+
import {
36+
pluginPrismic,
37+
definePrismicPluginOptions,
38+
} from "eleventy-plugin-prismic";
39+
40+
// This is a sugar function that gives you intellisense and
41+
// documentation in your IDE while defining plugin options.
42+
const prismicPluginOptions = definePrismicPluginOptions({
43+
endpoint: "your-repo-name",
44+
45+
// Optional, additional parameters to pass to the client
46+
clientConfig: {
47+
accessToken: "abc",
48+
},
49+
50+
/* see configuration references for more */
51+
});
52+
53+
const config = function (eleventyConfig) {
54+
eleventyConfig.addPlugin(pluginPrismic, prismicPluginOptions);
55+
};
56+
// This format is important if you want to setup previews
57+
// with the plugin.
58+
config.prismicPluginOptions = prismicPluginOptions;
59+
60+
export default config;
61+
```
62+
63+
</details>
64+
<br>
65+
3666
```javascript
3767
const {
3868
pluginPrismic,

0 commit comments

Comments
 (0)