web icon indicating copy to clipboard operation
web copied to clipboard

[rollup-plugin-html] Change file extension of transformed asset?

Open RebeccaStevens opened this issue 4 years ago • 1 comments

I want to be able to use a template format such as hbs or ejs for some assets.

I tried making the following transform function to do this but I'm not able to drop the ".hbs"/".ejs" extensions from the transformed file's name.

{
  transformAsset: async (content, filePath) => {
    if (filePath.endsWith(".hbs")) {
      const hbsContent = content.toString("utf-8");
      return renderHbs(hbsContent);
    }

    if (filePath.endsWith(".ejs")) {
      const ejsContent = content.toString("utf-8");
      return renderEjs(ejsContent);
    }
  }
}

Is it possible / could it be made possible for me to change the file extension of the transformed file?

RebeccaStevens avatar Jul 08 '21 13:07 RebeccaStevens

+1

dvjn avatar Dec 14 '21 18:12 dvjn