From be30a4028fd25d251b808f8bbecdf9046333fd9e Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 21 Apr 2017 23:16:20 +0200 Subject: [PATCH] feat(sass): add option to pass addition postcss plugins (#369) * feat(sass): add option to pass addition postcss plugins * chore(SassConfig): make postCssPlugins optional --- src/sass.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sass.ts b/src/sass.ts index fc94d23e..147c329c 100755 --- a/src/sass.ts +++ b/src/sass.ts @@ -277,7 +277,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()); @@ -441,7 +450,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[]; @@ -449,6 +458,7 @@ export interface SassConfig { sourceMap?: string; omitSourceMapUrl?: boolean; sourceMapContents?: boolean; + postCssPlugins?: any[]; }