In the Modify the bundle output section of the README, it includes an example of how to integrate postcss in a transform function. Without a way of knowing the bundle type, this transform would cause the build to fail because it cannot process non-CSS code.
This PR will fix that issue by exposing the bundle name in a type variable available to the transform callbacks. This would allow for the postcss example to work like so:
eleventyConfig.addPlugin(pluginBundle, {
transforms: [
async function (content) {
if (this.type === "css") {
let result = await postcss([postcssNested]).process(content, {
from: this.page.inputPath,
to: null,
});
return result.css;
}
return content;
},
],
});
I've included a test and also updated the README to reflect this change. Let me know if there's anything else I can provide!
In the Modify the bundle output section of the README, it includes an example of how to integrate
postcss
in a transform function. Without a way of knowing the bundle type, this transform would cause the build to fail because it cannot process non-CSS code.This PR will fix that issue by exposing the bundle name in a
type
variable available to the transform callbacks. This would allow for thepostcss
example to work like so:I've included a test and also updated the README to reflect this change. Let me know if there's anything else I can provide!