FileMatchers
FileMatchers =
MaybeArray<FileMatcher>
Defined in: types.ts:320
A single instance or an array of file matchers in following formats:
-
File name:
image.svg. -
Path to a file from the project’s root:
/src/assets/image.svg. -
RegExp: tested against file name (
image.svg) and relative path (/src/assets/image.svg). -
Function (FileMatcherFn) that accepts information about a file and returns
true, if line width should be preserved.
All paths use forward slash (/) as a separator. Relative paths start with /.
Recommendation: Include path information and use clean project structure to avoid unintentional matches.
Example
Section titled “Example”const matchers: FileMatchers = [ // Any file named "image.svg" "image.svg",
// Specific file "/src/assets/image.svg",
// Any path containing "/some/directory/" new RegExp("\/some\/directory\/"),
// Any file ending with "-image.svg" new RegExp("\\-image\\.svg$"),
// Any path containing "/some/directory/" or any file ending with "-image.svg" (ctx) => ctx.relativePath.includes("/some/directory/") || ctx.fullPath.endsWith("-image.svg"),];