Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
Allow modules to be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen Alewijns committed Nov 14, 2017
1 parent c26ec20 commit c36840a
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions lib/webpack/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,30 @@ module.exports = async function() {
options: {
sourceMap: isDev ? 'inline' : false,
plugins: loader => {
const defaultPlugins = () => [
require('autoprefixer')({
browsers: ['last 2 versions', 'IE 11']
}),
require('lost'),
require('postcss-custom-media'),
require('postcss-zindex'),
require('postcss-discard-duplicates'),
require('postcss-unique-selectors'),
require('postcss-responsive-type')
]
const defaultPlugins = (config = {}) =>
[
config.autoprefixer === false
? null
: require('autoprefixer')({
browsers: ['last 2 versions', 'IE 11']
}),
config.lost === false ? null : require('lost'),
config['postcss-custom-media'] === false
? null
: require('postcss-custom-media'),
config['postcss-zindex'] === false
? null
: require('postcss-zindex'),
config['postcss-discard-duplicates'] === false
? null
: require('postcss-discard-duplicates'),
config['postcss-unique-selectors'] === false
? null
: require('postcss-unique-selectors'),
config['postcss-responsive-type'] === false
? null
: require('postcss-responsive-type')
].filter(i => i !== null)
// Allow custom PostCSS configuration
if (themeConfig.postCss) {
return themeConfig.postCss(loader, defaultPlugins)
Expand Down

0 comments on commit c36840a

Please sign in to comment.