Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit be30a40

Browse files
alan-agius4danbucholtz
authored andcommitted
feat(sass): add option to pass addition postcss plugins (#369)
* feat(sass): add option to pass addition postcss plugins * chore(SassConfig): make postCssPlugins optional
1 parent fa5e52c commit be30a40

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/sass.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,16 @@ function renderSassSuccess(context: BuildContext, sassResult: Result, sassConfig
277277

278278
Logger.debug(`sass, start postcss/autoprefixer`);
279279

280-
return postcss([autoprefixer(sassConfig.autoprefixer)])
280+
let postCssPlugins = [autoprefixer(sassConfig.autoprefixer)];
281+
282+
if (sassConfig.postCssPlugins) {
283+
postCssPlugins = [
284+
...sassConfig.postCssPlugins,
285+
...postCssPlugins
286+
];
287+
}
288+
289+
return postcss(postCssPlugins)
281290
.process(sassResult.css, postcssOptions).then((postCssResult: any) => {
282291
postCssResult.warnings().forEach((warn: any) => {
283292
Logger.warn(warn.toString());
@@ -441,14 +450,15 @@ export interface SassConfig {
441450
excludeModules?: string[];
442451
includeFiles?: RegExp[];
443452
excludeFiles?: RegExp[];
444-
directoryMaps?: {[key: string]: string};
453+
directoryMaps?: { [key: string]: string };
445454
sortComponentPathsFn?: (a: any, b: any) => number;
446455
sortComponentFilesFn?: (a: any, b: any) => number;
447456
variableSassFiles?: string[];
448457
autoprefixer?: any;
449458
sourceMap?: string;
450459
omitSourceMapUrl?: boolean;
451460
sourceMapContents?: boolean;
461+
postCssPlugins?: any[];
452462
}
453463

454464

0 commit comments

Comments
 (0)