sapphi-red / vite-plugin-static-copy

rollup-plugin-copy with dev server support.
MIT License
299 stars 32 forks source link

Improve `rename` option JSDoc #125

Open benzsuankularb opened 3 months ago

benzsuankularb commented 3 months ago

Add the ability to transform file structure.

viteStaticCopy({
  targets: [
    {
      src: [
        'node_modules/my-lib/dist/**/*',
      ],
      dest: '.',
      transformStructure: (path) => path.replace('node_modules/my-lib/dist/', '')
    },
  ],
  structured: true,
}),
sapphi-red commented 3 months ago

Won't the rename option work for that?

benzsuankularb commented 3 months ago

Ah, I previously saw rename func returning a string, Not sure what's the return value is expected but thought it was only the filename that could be changed. So this option should work if rename could recompose the full path here. We may need some documents for this.