Skip to content

Commit

Permalink
feat(importer): extensions override
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed May 20, 2020
1 parent 6a52be8 commit 74fcd39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/loaders/postcss/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ export type ImportOptions = {
* - ex.: `{"foo":"bar"}`
*/
alias?: { [from: string]: string };
/**
* Import files ending with these extensions.
* Overrides the global `extensions` option.
* @default [".css", ".pcss", ".postcss", ".sss"]
*/
extensions?: string[];
};

type ImportPrivateOptions = { extensions?: string[] };
const plugin: postcss.Plugin<ImportOptions & ImportPrivateOptions> = postcss.plugin(
const plugin: postcss.Plugin<ImportOptions> = postcss.plugin(
name,
(options = {}) => async (css, res): Promise<void> => {
if (!css.source?.input.file) return;
Expand Down
2 changes: 1 addition & 1 deletion src/loaders/postcss/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const loader: Loader<PostCSSLoaderOptions> = {

const plugins = [
...[
options.import && postcssImport({ ...options.import, extensions: options.extensions }),
options.import && postcssImport({ extensions: options.extensions, ...options.import }),
options.url && postcssUrl(options.url),
].filter(booleanFilter),
...(options.postcss.plugins ?? []),
Expand Down

0 comments on commit 74fcd39

Please sign in to comment.