Skip to content

Commit

Permalink
feat: updates deps and new file/layout structure (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fupete authored Sep 26, 2024
1 parent 8edde5c commit 8110fe7
Show file tree
Hide file tree
Showing 48 changed files with 8,730 additions and 10,410 deletions.
47 changes: 32 additions & 15 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const EleventyPluginOgImage = require('eleventy-plugin-og-image');
const EleventyPluginEmoji = require('eleventy-plugin-emoji');

const rollupPluginCritical = require('rollup-plugin-critical').default;
const eslintPlugin = require('@rollup/plugin-eslint').default;

const filters = require('./utils/filters.js');
const transforms = require('./utils/transforms.js');
Expand All @@ -17,7 +16,6 @@ const pairedShortcodes = require('./utils/paired-shortcodes.js');

const path = require('path');
const fs = require('fs');
const { execSync } = require('child_process');

// markdown
const markdownIt = require('markdown-it');
Expand Down Expand Up @@ -113,7 +111,7 @@ module.exports = function (eleventyConfig) {
criticalBase: './_site/',
criticalPages: [
{ uri: 'en/index.html', template: 'index' },
{ uri: 'it/index.html', template: 'index' },
{ uri: 'it/index.html', template: 'index' }
],
criticalConfig: {
inline: true,
Expand All @@ -134,13 +132,9 @@ module.exports = function (eleventyConfig) {
],
penthouse: {
forceInclude: ['.fonts-loaded-1 body', '.fonts-loaded-2 body']
},
cleanCSS: {

}
}
}),
eslintPlugin()
})
]
}
}
Expand Down Expand Up @@ -227,18 +221,12 @@ module.exports = function (eleventyConfig) {
// Layouts
eleventyConfig.addLayoutAlias('base', 'base.njk');
eleventyConfig.addLayoutAlias('idea', 'idea.njk');
eleventyConfig.addLayoutAlias('portfolio', 'portfolio.njk');

// Copy/pass-through files
eleventyConfig.addPassthroughCopy('./src/assets/css');
eleventyConfig.addPassthroughCopy('./src/assets/js');

// Build pagefind index XXX
eleventyConfig.on('eleventy.after', async () => {
execSync(`npx pagefind --source _site --glob \"**/*.html\"`, {
encoding: 'utf-8'
});
});

// Localized notes
eleventyConfig.addCollection('ideas_en', (collectionApi) => {
return collectionApi.getFilteredByGlob('./src/en/ideas/**/*.md');
Expand All @@ -247,6 +235,35 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addCollection('ideas_it', (collectionApi) => {
return collectionApi.getFilteredByGlob('./src/it/ideas/**/*.md');
});
// Localized design projects
eleventyConfig.addCollection('design_en', (collectionApi) => {
return collectionApi.getFilteredByGlob('./src/en/design/**/*.md');
});
eleventyConfig.addCollection('design_it', (collectionApi) => {
return collectionApi.getFilteredByGlob('./src/it/design/**/*.md');
});

// Build pagefind index
eleventyConfig.on('eleventy.after', async function ({ dir }) {
const inputPath = dir.output;
const outputPath = path.join(dir.output, 'pagefind');

console.log('Creating Pagefind index of %s', inputPath);

const pagefind = await import('pagefind');
const { index } = await pagefind.createIndex();
const { errors, page_count } = await index.addDirectory({
path: inputPath,
glob: '**/*.{html}'
});
await index.writeFiles({ outputPath });

console.log(
'Created Pagefind index of %i pages in %s',
page_count,
outputPath
);
});

return {
templateFormats: ['md', 'njk', 'html', 'liquid'],
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v19.7.0
v20.11.0
Loading

0 comments on commit 8110fe7

Please sign in to comment.