@anydigital/11ty-bricks 1.0.0-alpha.10 → 1.0.0-alpha.11
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
|
@@ -589,6 +589,64 @@ The plugin also exports the following for advanced usage:
|
|
|
589
589
|
- `transformAutoRaw(content)`: The transform function used by `mdAutoRawTags` preprocessor. Can be used programmatically to wrap Nunjucks syntax with raw tags.
|
|
590
590
|
- `transformNl2br(content)`: The transform function used by `mdAutoNl2br` preprocessor. Can be used programmatically to convert `\n` sequences to `<br>` tags.
|
|
591
591
|
|
|
592
|
+
## Starter Configuration Files
|
|
593
|
+
|
|
594
|
+
The package includes pre-configured starter files in `node_modules/@anydigital/11ty-bricks/src/starter/` that you can symlink to your project for quick setup:
|
|
595
|
+
|
|
596
|
+
### Available Starter Files
|
|
597
|
+
|
|
598
|
+
#### eleventy.config.js
|
|
599
|
+
|
|
600
|
+
A fully-configured Eleventy config file with:
|
|
601
|
+
- All 11ty-bricks plugins enabled
|
|
602
|
+
- Eleventy Navigation plugin
|
|
603
|
+
- Markdown-it with anchors
|
|
604
|
+
- YAML data support
|
|
605
|
+
- CLI input directory support
|
|
606
|
+
- Symlink support for development
|
|
607
|
+
|
|
608
|
+
**Symlink to your project:**
|
|
609
|
+
```bash
|
|
610
|
+
ln -s node_modules/@anydigital/11ty-bricks/src/starter/eleventy.config.js eleventy.config.js
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
#### tailwind.config.js
|
|
614
|
+
|
|
615
|
+
A pre-configured Tailwind CSS config optimized for Eleventy projects with proper content paths.
|
|
616
|
+
|
|
617
|
+
**Symlink to your project:**
|
|
618
|
+
```bash
|
|
619
|
+
ln -s node_modules/@anydigital/11ty-bricks/src/starter/tailwind.config.js tailwind.config.js
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
#### admin/index.html
|
|
623
|
+
|
|
624
|
+
A ready-to-use Sveltia CMS admin interface for content management.
|
|
625
|
+
|
|
626
|
+
**Symlink to your project:**
|
|
627
|
+
```bash
|
|
628
|
+
mkdir -p admin
|
|
629
|
+
ln -s ../node_modules/@anydigital/11ty-bricks/src/starter/admin/index.html admin/index.html
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
### Benefits of Symlinking
|
|
633
|
+
|
|
634
|
+
- **Always up-to-date**: Configuration automatically updates when you upgrade the package
|
|
635
|
+
- **Less maintenance**: No need to manually sync configuration changes
|
|
636
|
+
- **Quick setup**: Get started immediately with best-practice configurations
|
|
637
|
+
- **Easy customization**: Override specific settings by creating your own config that imports from the symlinked version
|
|
638
|
+
|
|
639
|
+
### Alternative: Copy Files
|
|
640
|
+
|
|
641
|
+
If you prefer to customize the configurations extensively, you can copy the files instead:
|
|
642
|
+
|
|
643
|
+
```bash
|
|
644
|
+
cp node_modules/@anydigital/11ty-bricks/src/starter/eleventy.config.js .
|
|
645
|
+
cp node_modules/@anydigital/11ty-bricks/src/starter/tailwind.config.js .
|
|
646
|
+
mkdir -p admin
|
|
647
|
+
cp node_modules/@anydigital/11ty-bricks/src/starter/admin/index.html admin/
|
|
648
|
+
```
|
|
649
|
+
|
|
592
650
|
## CLI Helper Commands
|
|
593
651
|
|
|
594
652
|
After installing this package, the `download-files` command becomes available:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anydigital/11ty-bricks",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.11",
|
|
4
4
|
"description": "A collection of helpful utilities and filters for Eleventy (11ty)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"node": ">=18.0.0"
|
|
47
47
|
},
|
|
48
48
|
"_downloadFiles": {
|
|
49
|
-
"https://raw.githubusercontent.com/danurbanowicz/eleventy-sveltia-cms-starter/refs/heads/master/admin/index.html": "src/
|
|
49
|
+
"https://raw.githubusercontent.com/danurbanowicz/eleventy-sveltia-cms-starter/refs/heads/master/admin/index.html": "src/starter/admin/index.html"
|
|
50
50
|
}
|
|
51
51
|
}
|
package/src/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { siteData } from "./siteData.js";
|
|
|
19
19
|
* @param {boolean} options.fragments - Enable fragment shortcode (default: false)
|
|
20
20
|
* @param {boolean} options.setAttrFilter - Enable setAttr filter (default: false)
|
|
21
21
|
* @param {boolean} options.byAttrFilter - Enable byAttr filter (default: false)
|
|
22
|
-
* @param {boolean} options.siteData - Enable site.year global data (default: false)
|
|
22
|
+
* @param {boolean} options.siteData - Enable site.year and site.isProd global data (default: false)
|
|
23
23
|
*/
|
|
24
24
|
export default function eleventyBricksPlugin(eleventyConfig, options = {}) {
|
|
25
25
|
const plugins = { bricks, mdAutoRawTags, mdAutoNl2br, fragments, setAttrFilter, byAttrFilter, siteData };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* CLI */
|
|
2
|
+
import minimist from "minimist";
|
|
3
|
+
/* Plugins */
|
|
4
|
+
import { RenderPlugin } from "@11ty/eleventy";
|
|
5
|
+
import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
|
|
6
|
+
import eleventyBricksPlugin from "@anydigital/11ty-bricks";
|
|
7
|
+
/* Libraries */
|
|
8
|
+
import markdownIt from "markdown-it";
|
|
9
|
+
import markdownItAnchor from "markdown-it-anchor";
|
|
10
|
+
/* Data */
|
|
11
|
+
import yaml from "js-yaml";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Eleventy Configuration
|
|
15
|
+
* @param {Object} eleventyConfig - The Eleventy configuration object
|
|
16
|
+
* @returns {Object} The Eleventy configuration object
|
|
17
|
+
*/
|
|
18
|
+
export default function(eleventyConfig) {
|
|
19
|
+
/* CLI support */
|
|
20
|
+
const argv = minimist(process.argv.slice(2));
|
|
21
|
+
const inputDir = argv.input || "src";
|
|
22
|
+
|
|
23
|
+
/* Plugins */
|
|
24
|
+
eleventyConfig.addPlugin(RenderPlugin);
|
|
25
|
+
eleventyConfig.addPlugin(eleventyNavigationPlugin);
|
|
26
|
+
eleventyConfig.addPlugin(eleventyBricksPlugin, {
|
|
27
|
+
bricks: true,
|
|
28
|
+
fragments: true,
|
|
29
|
+
mdAutoNl2br: true,
|
|
30
|
+
mdAutoRawTags: true,
|
|
31
|
+
setAttrFilter: true,
|
|
32
|
+
byAttrFilter: true,
|
|
33
|
+
siteData: true
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/* Libraries */
|
|
37
|
+
eleventyConfig.setLibrary("md", markdownIt({
|
|
38
|
+
html: true,
|
|
39
|
+
breaks: true,
|
|
40
|
+
linkify: true
|
|
41
|
+
}).use(markdownItAnchor, {
|
|
42
|
+
permalink: markdownItAnchor.permalink.headerLink()
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
/* Data */
|
|
46
|
+
eleventyConfig.addDataExtension("yml", (contents) => yaml.safeLoad(contents));
|
|
47
|
+
|
|
48
|
+
/* Build */
|
|
49
|
+
eleventyConfig.addPassthroughCopy({
|
|
50
|
+
"_public": ".",
|
|
51
|
+
...(inputDir !== "src" && { [`${inputDir}/_public`]: "." })
|
|
52
|
+
}, { expand: true }); // This follows/resolves symbolic links
|
|
53
|
+
|
|
54
|
+
/* Dev tools */
|
|
55
|
+
// Follow symlinks in Chokidar used by 11ty to watch files
|
|
56
|
+
eleventyConfig.setChokidarConfig({ followSymlinks: true });
|
|
57
|
+
|
|
58
|
+
/* Config */
|
|
59
|
+
return {
|
|
60
|
+
templateFormats: ["md", "njk"],
|
|
61
|
+
htmlTemplateEngine: "njk",
|
|
62
|
+
dir: {
|
|
63
|
+
input: inputDir,
|
|
64
|
+
includes: "_template"
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
File without changes
|