Skip to content

Commit

Permalink
fix: onExtract option fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed May 13, 2020
1 parent 3408f29 commit 65d74cf
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@types/mime-types": "^2.1.0",
"@types/node": "*",
"@types/postcss-load-config": "^2.0.1",
"@types/resolve": "^1.17.0",
"@types/resolve": "^1.17.1",
"@types/uglifycss": "^0.0.5",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default (options: Options = {}): Plugin => {
const res = getExtractedData(name, ids);

if (options.onExtract) {
const shouldExtract = options.onExtract(getExtractedData);
const shouldExtract = options.onExtract(res);
if (!shouldExtract) continue;
}

Expand Down
7 changes: 4 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,15 @@ export interface Options {
* */
loaders?: Loader[];
/**
* Function which is invoked on CSS file import
* Function which is invoked on CSS file import,
* before any transformations are applied
* @default undefined
* */
onImport?: (code: string, id: string) => void;
/**
* Function which is invoked on CSS file import.
* Function which is invoked on CSS file export.
* Return `boolean` to decide if you want to extract the file or not.
* @default undefined
* */
onExtract?: (fn: (name: string, ids: string[]) => ExtractedData) => boolean;
onExtract?: (data: ExtractedData) => boolean;
}

0 comments on commit 65d74cf

Please sign in to comment.