rollup-plugin-copy
rollup-plugin-copy copied to clipboard
I wonder if it is possible not to copy a file when it conforms to a set of regular expressions
copy({
targets: [{ src: 'src/*', exclude: ['*.md', 'demo'], dest: 'dist' }],
})
not using regular expressions, but using glob syntax from main readme
the negate pattern doesn't seem to work. it just copies all files.
copy({ targets: [ { src: ['!**/*.scss', '!**/*.svg', 'src/themes/**/*'], dest: 'lib' }, ], flatten: false, }),
@pancake-boy I believe it's a question of order. the negation patterns exclude previously matched files. Try putting the 'src/themes/**/*' first in the array.
@pancake-boy I believe it's a question of order. the negation patterns exclude previously matched files. Try putting the 'src/themes/**/*' first in the array.
I can't get the negated patterns to work 100% either. Tried a bunch of different ways
copy({ targets: [{ src: ['public/*', '!public/tiles'], dest: OUT_DIR }] }),
this works, will skip tiles directory
copy({ targets: [{ src: ['public/*', '!*.map', '!public/tiles'], dest: OUT_DIR }] }),
this doesn't skip .map files but does skip tiles directory
copy({ targets: [{ src: ['public/*', '!**/*.map', '!public/tiles'], dest: OUT_DIR }] }),
this is the example from the Readme and it does not skip .map files
copy({ targets: [{ src: ['public/*', '!public/**/*.map', '!public/tiles'], dest: OUT_DIR }] }),
this also does not skip .map files
Also negated pattern with template literals don't work either copy({ targets: [{ src: [`${PUBLIC_ASSETS_DIR}/*`, `!${PUBLIC_ASSETS_DIR}}/tiles`], dest: OUT_DIR }] })
negated patterns not work + 1
{src: ['src/data', '!src/data/geojson'], dest: 'dist'}
To use negated patterns, I needed to specify the expandDirectories and onlyFiles options to true.
copy({
targets: [
{
src: ['src/', '!src/**/*.test.ts'],
dest: 'dist/browser/src/',
expandDirectories: true,
onlyFiles: true,
},
],
flatten: false,
});
These options are intentionally being set to false here. Perhaps there is a good reason for these defaults? If so, maybe just adjusting this README.md example could be enough,