Skip to content

Commit ba48b5e

Browse files
committed
chore: trying again to disable pagefind 1st build
1 parent 5e5dff0 commit ba48b5e

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

.eleventy.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,26 +244,26 @@ module.exports = function (eleventyConfig) {
244244
});
245245

246246
// Build pagefind index
247-
// eleventyConfig.on('eleventy.after', async function ({ dir }) {
248-
// const inputPath = dir.output;
249-
// const outputPath = path.join(dir.output, 'pagefind');
247+
eleventyConfig.on('eleventy.after', async function ({ dir }) {
248+
const inputPath = dir.output;
249+
const outputPath = path.join(dir.output, 'pagefind');
250250

251-
// console.log('Creating Pagefind index of %s', inputPath);
251+
console.log('Creating Pagefind index of %s', inputPath);
252252

253-
// const pagefind = await import('pagefind');
254-
// const { index } = await pagefind.createIndex();
255-
// const { errors, page_count } = await index.addDirectory({
256-
// path: inputPath,
257-
// glob: '**/*.{html}'
258-
// });
259-
// await index.writeFiles({ outputPath });
253+
const pagefind = await import('pagefind');
254+
const { index } = await pagefind.createIndex();
255+
const { errors, page_count } = await index.addDirectory({
256+
path: inputPath,
257+
glob: '**/*.{html}'
258+
});
259+
await index.writeFiles({ outputPath });
260260

261-
// console.log(
262-
// 'Created Pagefind index of %i pages in %s',
263-
// page_count,
264-
// outputPath
265-
// );
266-
// });
261+
console.log(
262+
'Created Pagefind index of %i pages in %s',
263+
page_count,
264+
outputPath
265+
);
266+
});
267267

268268
return {
269269
templateFormats: ['md', 'njk', 'html', 'liquid'],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"serve": "npx @11ty/eleventy --serve",
1515
"bench": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
1616
"build": "env NODE_ENV=production npx @11ty/eleventy",
17-
"pTEMPostbuild": "env NODE_ENV=production npx pagefind --site _site --glob '**/*.html'",
17+
"postbuild": "env NODE_ENV=production npx pagefind --site _site --glob '**/*.html'",
1818
"clean": "del-cli _site",
1919
"format:style": "stylelint --allow-empty-input '**/*.{css,scss}' --fix",
2020
"format:md": "prettier '**/*.md' --write && eslint '**/*.md' --fix",

src/assets/js/pagefind.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// generated pagefind UI
2-
import '../../pagefind/pagefind-ui.js'; // xxx doesn't work on 1st build
2+
// import '../../pagefind/pagefind-ui.js'; // xxx doesn't work on 1st build
33

4-
const initSearch = () => {
5-
/* global PagefindUI */
6-
/* eslint no-undef: "error"*/
7-
new PagefindUI({
8-
element: '#searchBox',
9-
showImages: true,
10-
showEmptyFilters: true,
11-
bundlePath: '/pagefind/'
12-
});
13-
const inputSearch = document.querySelector('input');
14-
inputSearch.setAttribute('id', 'site-search');
15-
};
16-
const isHome = document.querySelector('.home');
17-
if (isHome) initSearch();
4+
// const initSearch = () => {
5+
// /* global PagefindUI */
6+
// /* eslint no-undef: "error"*/
7+
// new PagefindUI({
8+
// element: '#searchBox',
9+
// showImages: true,
10+
// showEmptyFilters: true,
11+
// bundlePath: '/pagefind/'
12+
// });
13+
// const inputSearch = document.querySelector('input');
14+
// inputSearch.setAttribute('id', 'site-search');
15+
// };
16+
// const isHome = document.querySelector('.home');
17+
// if (isHome) initSearch();

0 commit comments

Comments
 (0)