Skip to content

Commit

Permalink
allow configure processOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 22, 2023
1 parent 145b6e8 commit c31635d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { CommonOptions } from "esbuild";
import type { AcceptedPlugin as PostcssPlugin } from "postcss";
import type {
AcceptedPlugin as PostcssPlugin,
ProcessOptions as PostcssProcessOptions,
} from "postcss";
import type { Options as PostcssNestedOptions } from "postcss-nested";
import type { Options as AutoprefixerOptions } from "autoprefixer";
import type { Options as CssnanoOptions } from "cssnano";
Expand Down Expand Up @@ -43,6 +46,7 @@ export interface LoaderOptions {
autoprefixer?: false | AutoprefixerOptions;
cssnano?: false | CssnanoOptions;
plugins?: PostcssPlugin[];
processOptions?: Omit<PostcssProcessOptions, "from">;
};
}

Expand Down
1 change: 1 addition & 0 deletions src/loaders/postcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const postcssLoader: Loader = async (input, ctx) => {
...(ctx.options.postcss?.plugins || []),
].filter(Boolean),
).process(contents, {
...ctx.options.postcss?.processOptions,
from: input.srcPath,
});

Expand Down

0 comments on commit c31635d

Please sign in to comment.