feat: Add liquid root setting
Set root in eleventy config with setLiquidOptions to include hippie files.
This commit is contained in:
parent
d4eb2f743b
commit
6ab274b4bb
1 changed files with 15 additions and 14 deletions
29
.eleventy.js
29
.eleventy.js
|
|
@ -1,12 +1,13 @@
|
||||||
/* jshint strict: false */
|
/* jshint strict: false */
|
||||||
|
|
||||||
import fs from 'fs/promises';
|
import fs from "node:fs";
|
||||||
import {HtmlBasePlugin} from "@11ty/eleventy";
|
import path from "node:path";
|
||||||
|
import { HtmlBasePlugin } from "@11ty/eleventy";
|
||||||
import pluginWebc from "@11ty/eleventy-plugin-webc";
|
import pluginWebc from "@11ty/eleventy-plugin-webc";
|
||||||
|
|
||||||
async function hasFiles(dirPath) {
|
async function hasFiles(dirPath) {
|
||||||
try {
|
try {
|
||||||
const entries = await fs.readdir(dirPath, {withFileTypes: true});
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
||||||
return entries.some(entry => entry.isFile());
|
return entries.some(entry => entry.isFile());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error reading directory:', err);
|
console.error('Error reading directory:', err);
|
||||||
|
|
@ -20,11 +21,11 @@ export default async function (eleventyConfig) {
|
||||||
eleventyConfig.addPlugin(pluginWebc);
|
eleventyConfig.addPlugin(pluginWebc);
|
||||||
|
|
||||||
eleventyConfig.setLiquidOptions({
|
eleventyConfig.setLiquidOptions({
|
||||||
// greedy: false,
|
root: [
|
||||||
// trimOutputLeft: true,
|
eleventyConfig.directories.includes,
|
||||||
// trimOutputRight: true,
|
// eleventyConfig.directories.input + '../_includes',
|
||||||
// trimTagLeft: true,
|
fs.realpathSync(path.resolve('./node_modules/hippie/source/view/_includes'))
|
||||||
// trimTagRight : true,
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addGlobalData('permalink', () => {
|
eleventyConfig.addGlobalData('permalink', () => {
|
||||||
|
|
@ -116,18 +117,18 @@ export default async function (eleventyConfig) {
|
||||||
return `<div class="${attrClass}">` + output + `</div>`;
|
return `<div class="${attrClass}">` + output + `</div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addPassthroughCopy({'source/art/images': 'art'});
|
eleventyConfig.addPassthroughCopy({ 'source/art/images': 'art' });
|
||||||
eleventyConfig.addPassthroughCopy({'source/art/favicons/**/*.+(ico|png|svg)': '.'});
|
eleventyConfig.addPassthroughCopy({ 'source/art/favicons/**/*.+(ico|png|svg)': '.' });
|
||||||
eleventyConfig.addPassthroughCopy({'source/code/**/*.js': 'js'});
|
eleventyConfig.addPassthroughCopy({ 'source/code/**/*.js': 'js' });
|
||||||
eleventyConfig.addPassthroughCopy({'source/data/**/*.json': 'json'});
|
eleventyConfig.addPassthroughCopy({ 'source/data/**/*.json': 'json' });
|
||||||
|
|
||||||
eleventyConfig.addPassthroughCopy('vendor');
|
eleventyConfig.addPassthroughCopy('vendor');
|
||||||
eleventyConfig.addPassthroughCopy({'node_modules/bootstrap-icons': 'vendor/bootstrap-icons'});
|
eleventyConfig.addPassthroughCopy({ 'node_modules/bootstrap-icons': 'vendor/bootstrap-icons' });
|
||||||
eleventyConfig.addPassthroughCopy({
|
eleventyConfig.addPassthroughCopy({
|
||||||
'node_modules/jquery/dist/jquery.min.js': 'vendor/jquery.min.js',
|
'node_modules/jquery/dist/jquery.min.js': 'vendor/jquery.min.js',
|
||||||
'node_modules/jquery/dist/jquery.min.map': 'vendor/jquery.min.map'
|
'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/');
|
eleventyConfig.addWatchTarget('./source/style/');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue