typesite-filter-out
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Typesite-filter-out

A plugin for Typesite that allows you to filter out files.

Installation

Run npm install typesite-filter-out

How to use

Register the plugin in your Typesite project passing either a regular expression or a multimatch pattern. File paths that are matched will be removed.

// This will remove every exe file, thumbs.db and desktop.ini
typesite.use(new FilterOutPlugin(["thumbs.db", "desktop.ini", "**/*.exe"]));

if (process.env.NODE_ENV === "production"){
	// Remove every file that has '.draft' in its path
	typesite.use(new FilterOutPlugin(/\.draft/));    
}

API

FilterOutPlugin

The plugin that does the filtering:

constructor

  • Argument patternToFilterOut :RegExp | string[] An array of strings to pass to multimatch or a regular expression which is used for filtering
  • Argument [Optional] multimatchImplementation :(files: string[], patterns: string[]) => string[] An optional implementation of multimatch to inject into this class, if null or not defined will use the default multimatch.
  • Exception Typesite.ArgumentNullError Thrown when patternToFilterOut is null
  • Exception Typeiste.ArgumentInvalidError Thrown when patternToFilterOut is not an instance of RegExp or a non-empty array of strings

Note about paths

Matching is done against target path, so if you move files before applying filter plugin then they may not match anymore. Target path is initially set to source path.

Package Sidebar

Install

npm i typesite-filter-out

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

14.8 kB

Total Files

10

Last publish

Collaborators

  • skell