LinbuduLab / esbuild-plugins

ESBuild plugins by @LinbuduLab
MIT License
113 stars 18 forks source link

esbuild-plugin-copy: keep directory structure #57

Closed jaschaio closed 2 years ago

jaschaio commented 2 years ago

How do I keep the directory structure when copying?

assets: [ {
    from: [ './node_modules/tinymce/skins/**/*' ],
    to: [ './js/skins' ],
} ]

This merges all files within the root directory /js/skins/ and doesn't preserve the original directory structure.

linbudu599 commented 2 years ago

The easiest way is to configure it explicitly:

assets: [
          {
            from: ["./node_modules/tinymce/themes/mobile/*"],
            to: ["./js/skins/mobile"],
          },
          {
            from: ["./node_modules/tinymce/themes/silver/*"],
            to: ["./js/skins/silver"],
          },
        ]
jaschaio commented 2 years ago

Yeah thats the solution I came up with but it's pretty ugly once you have a handful of subdirectories to copy as well.

linbudu599 commented 2 years ago

This is supported at latest version 1.0.1, please refers to esbuild-plugin-copy#preserve-file-structure