Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compression - How to ignore files #45

Open
peekxc opened this issue Aug 23, 2024 · 1 comment
Open

compression - How to ignore files #45

peekxc opened this issue Aug 23, 2024 · 1 comment

Comments

@peekxc
Copy link

peekxc commented Aug 23, 2024

How can I add files/paths to ignore?

Since the compression works on the output directory---not on the input-to-output cascade eleventy performs---it seems to be oblivious to paths added via eleventyConfig.ignores.add. For example, if I have a custom route leading to a file that doesn't exist on my local machine:

...
<script defer src="/_vercel/insights/script.js"> </script>
...

The compression plugin detects the path and tries to compress it:

10:13:21 AM -> Icons: Start to compress "docs/_vercel/insights/script.js" file 🆙
 10:13:21 AM -> Icons: Error: ENOENT: no such file or directory, open '/Users/mpiekenbrock/peekxc.github.io/docs/_vercel/speed-insights/script.js'
Error: ENOENT: no such file or directory, open '/Users/mpiekenbrock/peekxc.github.io/docs/_vercel/speed-insights/script.js'
    at async open (node:internal/fs/promises:641:25)
    at async Object.readFile (node:internal/fs/promises:1254:14)
    at async w (/Users/mpiekenbrock/peekxc.github.io/node_modules/eleventy-plugin-compress/index.js:1:1480)
    at async Promise.all (index 4)
    at async Promise.all (index 0)
    at async A (/Users/mpiekenbrock/peekxc.github.io/node_modules/eleventy-plugin-compress/index.js:1:2424)
    at async Object.<anonymous> (/Users/mpiekenbrock/peekxc.github.io/node_modules/eleventy-plugin-compress/index.js:1:2947)
    at async Template.runTransforms (/Users/mpiekenbrock/.nvm/versions/node/v18.1.0/lib/node_modules/@11ty/eleventy/src/Template.js:514:15)
    at async Template.renderPageEntry (/Users/mpiekenbrock/.nvm/versions/node/v18.1.0/lib/node_modules/@11ty/eleventy/src/Template.js:799:15)
    at async /Users/mpiekenbrock/.nvm/versions/node/v18.1.0/lib/node_modules/@11ty/eleventy/src/Template.js:822:21 💥

But there is no such file, so this just floods the output with errors.

Edit: seems related if not identical to #8

@Kapelianovych
Copy link
Contributor

Hello. Currently there is no way to ignore files or specifically ensure that some files will be compressed. Besides these plugins were created for Eleventy 0.12-13 if I remember correctly, so we need to update them for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants