Skip to content

Commit

Permalink
fix(docz-plugin-css): fix empty loaderOpts
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Sep 2, 2018
1 parent ac359ce commit 193367b
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions packages/docz-plugin-css/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,23 @@ const getStyleLoaders = (loader: any, opts: Opts) => (

const loaders = {
postcss: (opts: Opts = { plugins: [] }) =>
getStyleLoaders(require.resolve('postcss-loader'), {
plugins: () =>
opts.plugins.concat([
require('postcss-flexbugs-fixes'),
require('autoprefixer')({
flexbox: 'no-2009',
}),
]),
}),
getStyleLoaders(
require.resolve('postcss-loader'),
merge(opts, {
plugins: () => {
const defaultPlugins = [
require('postcss-flexbugs-fixes'),
require('autoprefixer')({
flexbox: 'no-2009',
}),
]

return opts && opts.plugins && Array.isArray(opts.plugins)
? opts.plugins.concat(defaultPlugins)
: defaultPlugins
},
})
),

sass: (opts: Opts = {}) =>
getStyleLoaders(
Expand Down Expand Up @@ -110,6 +118,8 @@ export interface CSSPluginOptions {
const defaultOpts: Record<string, any> = {
preprocessor: 'postcss',
cssmodules: false,
loadersOpts: {},
cssOpts: {},
}

export const css = (opts: CSSPluginOptions = defaultOpts) =>
Expand Down

0 comments on commit 193367b

Please sign in to comment.