@anydigital/11ty-bricks 1.0.0-alpha.5 → 1.0.0-alpha.6

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/README.md CHANGED
@@ -102,7 +102,7 @@ When building reusable components (bricks) in Eleventy, you often need to includ
102
102
 
103
103
  **How it works:**
104
104
 
105
- 1. Use the `rootBrick` shortcode in your base template to mark where dependencies should be injected
105
+ 1. Use the `bricksRegistry` shortcode in your base template to mark where dependencies should be injected
106
106
  2. Use the `brick` shortcode to register and render brick components that declare their dependencies
107
107
  3. The system automatically collects all dependencies and injects them when the page is built
108
108
 
@@ -120,13 +120,13 @@ export default function(eleventyConfig) {
120
120
  }
121
121
  ```
122
122
 
123
- 2. Add the `rootBrick` shortcode in your base template (typically in the `<head>` section):
123
+ 2. Add the `bricksRegistry` shortcode in your base template (typically in the `<head>` section):
124
124
 
125
125
  ```njk
126
126
  <head>
127
127
  <meta charset="UTF-8">
128
128
  <title>My Site</title>
129
- {% rootBrick %}
129
+ {% bricksRegistry %}
130
130
  <!-- Other head content -->
131
131
  </head>
132
132
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anydigital/11ty-bricks",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "A collection of helpful utilities and filters for Eleventy (11ty)",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -53,13 +53,13 @@ export function bricksRegistry(eleventyConfig) {
53
53
  return '';
54
54
  });
55
55
 
56
- // rootBrick shortcode: outputs placeholder and base dependencies
57
- eleventyConfig.addShortcode("rootBrick", function(options = {}) {
56
+ // bricksRegistry shortcode: outputs placeholder and base dependencies
57
+ eleventyConfig.addShortcode("bricksRegistry", function(dependencies = []) {
58
58
  const registry = getPageRegistry(this.page);
59
59
 
60
60
  // Register root dependencies if provided (categorized later in transform)
61
- if (options.dependencies) {
62
- options.dependencies.forEach(dep => {
61
+ if (dependencies && Array.isArray(dependencies)) {
62
+ dependencies.forEach(dep => {
63
63
  registry.dependencies.add(dep);
64
64
  });
65
65
  }