eleventy: bug: trying to create a file with any extension other than html
Describe the bug I’m trying to output different files with extension .css or .xml using the syntax:
---
permalink: /assets/css/styles.css
---
---
permalink: /feed.xml
---
Expected behavior I’m expecting to find the created files but I get these errors:
> The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
`TypeError` was thrown:
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
Environment:
- OS and Version: Windows 10 and Linux (Ubuntu 20.04)
- Eleventy Version: 0.11.0
Do I need to set something in the .eleventy.js? How can I debug this “undefined” data?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (2 by maintainers)
I was using
html-minifier
and it was returning undefined if the file didn’t end with.html
, which the.xml
file wasn’t. In my code I updated it from:To this:
It now works
thanks @phazonoverload, I was having the same problem with a custom transform and your code helped me see the problem (I also wasn’t returning the original content when my initial condition didn’t match).
Was there any update to this issue? I’m facing what I think is a similar problem.
When I try and create a
.xml
or.json
file from my Liquid template by specifying extension in thepermalink
property I get a file where the content is only: