Skip to content

compression - How to ignore files #45

@peekxc

Description

@peekxc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions