From 6ab274b4bb9529ca0e72588825f914d91bee7d00 Mon Sep 17 00:00:00 2001 From: sthag Date: Mon, 20 Apr 2026 00:11:13 +0200 Subject: [PATCH] feat: Add liquid root setting Set root in eleventy config with setLiquidOptions to include hippie files. --- .eleventy.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index a29e297..9301ae5 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,12 +1,13 @@ /* jshint strict: false */ -import fs from 'fs/promises'; -import {HtmlBasePlugin} from "@11ty/eleventy"; +import fs from "node:fs"; +import path from "node:path"; +import { HtmlBasePlugin } from "@11ty/eleventy"; import pluginWebc from "@11ty/eleventy-plugin-webc"; async function hasFiles(dirPath) { try { - const entries = await fs.readdir(dirPath, {withFileTypes: true}); + const entries = await fs.readdir(dirPath, { withFileTypes: true }); return entries.some(entry => entry.isFile()); } catch (err) { console.error('Error reading directory:', err); @@ -20,11 +21,11 @@ export default async function (eleventyConfig) { eleventyConfig.addPlugin(pluginWebc); eleventyConfig.setLiquidOptions({ - // greedy: false, - // trimOutputLeft: true, - // trimOutputRight: true, - // trimTagLeft: true, - // trimTagRight : true, + root: [ + eleventyConfig.directories.includes, + // eleventyConfig.directories.input + '../_includes', + fs.realpathSync(path.resolve('./node_modules/hippie/source/view/_includes')) + ] }); eleventyConfig.addGlobalData('permalink', () => { @@ -116,18 +117,18 @@ export default async function (eleventyConfig) { return `
` + output + `
`; }); - eleventyConfig.addPassthroughCopy({'source/art/images': 'art'}); - eleventyConfig.addPassthroughCopy({'source/art/favicons/**/*.+(ico|png|svg)': '.'}); - eleventyConfig.addPassthroughCopy({'source/code/**/*.js': 'js'}); - eleventyConfig.addPassthroughCopy({'source/data/**/*.json': 'json'}); + eleventyConfig.addPassthroughCopy({ 'source/art/images': 'art' }); + eleventyConfig.addPassthroughCopy({ 'source/art/favicons/**/*.+(ico|png|svg)': '.' }); + eleventyConfig.addPassthroughCopy({ 'source/code/**/*.js': 'js' }); + eleventyConfig.addPassthroughCopy({ 'source/data/**/*.json': 'json' }); eleventyConfig.addPassthroughCopy('vendor'); - eleventyConfig.addPassthroughCopy({'node_modules/bootstrap-icons': 'vendor/bootstrap-icons'}); + eleventyConfig.addPassthroughCopy({ 'node_modules/bootstrap-icons': 'vendor/bootstrap-icons' }); eleventyConfig.addPassthroughCopy({ 'node_modules/jquery/dist/jquery.min.js': 'vendor/jquery.min.js', 'node_modules/jquery/dist/jquery.min.map': 'vendor/jquery.min.map' }); - eleventyConfig.addPassthroughCopy({'node_modules/hippie-script/index.js': 'vendor/hippie-script.js'}); + eleventyConfig.addPassthroughCopy({ 'node_modules/hippie-script/index.js': 'vendor/hippie-script.js' }); eleventyConfig.addWatchTarget('./source/style/'); }