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 */
|
||||
|
||||
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 `<div class="${attrClass}">` + output + `</div>`;
|
||||
});
|
||||
|
||||
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/');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue