lwojcik / eleventy-template-bliss

Single-column blog template for Eleventy focused on simplicity without sacrificing functionality
https://eleventy-bliss.lkmt.us/
MIT License
88 stars 20 forks source link

Project doesn't compile when a subdirectory flag is enabled #98

Closed Bullrich closed 8 months ago

Bullrich commented 9 months ago

Hi! I have been trying to implement this template for a subdirectory of mine, but unfortunately I have encountered a problem.

The project doesn't build when deploying to a subdirectory with a path prefix.

11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble writing to "_site/about/index.html" from "./content/pages/about.md" (via EleventyTemplateError)
[11ty] 2. Transform `imageConversion` encountered an error when transforming ./content/pages/about.md. (via EleventyTransformError)
[11ty] 3. ENOENT: no such file or directory, open '/Users/Repos/eleventy-template-bliss/assets/test/images/kitty.jpg' (via Error)
[11ty] 
[11ty] Original error stack trace: Error: ENOENT: no such file or directory, open '/Users/Repos/eleventy-template-bliss/assets/test/images/kitty.jpg'
[11ty]     at Object.openSync (node:fs:581:18)
[11ty]     at readFileSync (node:fs:457:35)
[11ty]     at processImage (/Users/Repos/eleventy-template-bliss/_11ty/plugins/srcset.js:107:20)
[11ty]     at /Users/Repos/eleventy-template-bliss/_11ty/plugins/srcset.js:154:43
[11ty]     at Array.map (<anonymous>)
[11ty]     at Object.convert (/Users/Repos/eleventy-template-bliss/_11ty/plugins/srcset.js:154:32)
[11ty]     at Object.<anonymous> (/Users/Repos/eleventy-template-bliss/node_modules/@11ty/eleventy/src/BenchmarkGroup.js:32:26)
[11ty]     at Template.runTransforms (/Users/Repos/eleventy-template-bliss/node_modules/@11ty/eleventy/src/Template.js:514:30)
[11ty]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[11ty]     at async Template.renderPageEntry (/Users/Repos/eleventy-template-bliss/node_modules/@11ty/eleventy/src/Template.js:799:15)
[11ty] Benchmark    266ms  13%    69× (Configuration) "imageConversion" Transform

To test simply add a pathPrefix value to the return object in eleventy.js

For example:

  return {
    dir: {
      input: constants.CONTENT_FOLDER,
    },
    templateFormats: ['md', 'njk'],
    htmlTemplateEngine: 'njk',
    markdownTemplateEngine: 'njk',
+   pathPrefix: "/test/"
  };

It seems to be related to some of the post build process, as eleventy builds by default without this problem in an empty project.

lwojcik commented 9 months ago

Hi @Bullrich! Thanks for letting me know, I'll have a look at it soon.

lwojcik commented 8 months ago

Fixed in v2.4.1.

If you want to cherry-pick a fix to your project, copy-paste the entire contents of _11ty/plugins/srcset.js.

Let me know if you need anything else!

Bullrich commented 8 months ago

Thank you very much for fixing it! It works now!