From 0a47712f6b1563f5e95d08b7e53e2fafbde4c44c Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 11 Nov 2016 17:45:26 +0100 Subject: [PATCH 1/2] feat(sass): add option to pass addition postcss plugins --- src/sass.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sass.ts b/src/sass.ts index 9a2ff511..f6f15b79 100755 --- a/src/sass.ts +++ b/src/sass.ts @@ -274,7 +274,16 @@ function renderSassSuccess(context: BuildContext, sassResult: Result, sassConfig Logger.debug(`sass, start postcss/autoprefixer`); - return postcss([autoprefixer(sassConfig.autoprefixer)]) + let postCssPlugins = [autoprefixer(sassConfig.autoprefixer)]; + + if (sassConfig.postCssPlugins) { + postCssPlugins = [ + ...sassConfig.postCssPlugins, + ...postCssPlugins + ]; + } + + return postcss(postCssPlugins) .process(sassResult.css, postcssOptions).then((postCssResult: any) => { postCssResult.warnings().forEach((warn: any) => { Logger.warn(warn.toString()); @@ -446,7 +455,7 @@ export interface SassConfig { excludeModules?: string[]; includeFiles?: RegExp[]; excludeFiles?: RegExp[]; - directoryMaps?: {[key: string]: string}; + directoryMaps?: { [key: string]: string }; sortComponentPathsFn?: (a: any, b: any) => number; sortComponentFilesFn?: (a: any, b: any) => number; variableSassFiles?: string[]; @@ -454,6 +463,7 @@ export interface SassConfig { sourceMap?: string; omitSourceMapUrl?: boolean; sourceMapContents?: boolean; + postCssPlugins: any[]; } From 99126efbb590082ab0bfcaabe4ec0e2e6699dd6e Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 11 Nov 2016 17:58:30 +0100 Subject: [PATCH 2/2] chore(SassConfig): make postCssPlugins optional --- src/sass.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sass.ts b/src/sass.ts index f6f15b79..7ccee47c 100755 --- a/src/sass.ts +++ b/src/sass.ts @@ -463,7 +463,7 @@ export interface SassConfig { sourceMap?: string; omitSourceMapUrl?: boolean; sourceMapContents?: boolean; - postCssPlugins: any[]; + postCssPlugins?: any[]; }