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

Commit

Permalink
Add default postcss plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
timneutkens committed Sep 2, 2017
1 parent 1ac3a30 commit 8423610
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
26 changes: 19 additions & 7 deletions lib/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ module.exports = async function() {
)
}

const postCssDefault = () => [
require('autoprefixer')({ browsers: ['last 2 versions', 'IE 11'] })
]

const postCss = themeConfig.postCss ? themeConfig.postCss : postCssDefault

const extractSass = new ExtractTextPlugin({
filename: '[name].css',
disable: isDev
Expand Down Expand Up @@ -96,7 +90,25 @@ module.exports = async function() {
loader: 'postcss-loader',
options: {
sourceMap: isDev ? 'inline' : false,
plugins: postCss
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')
]

// Allow custom PostCSS configuration
if (themeConfig.postCss) {
return themeConfig.postCss(loader, defaultPlugins)
}

return defaultPlugins()
}
}
},
{
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@
"file-loader": "^0.11.2",
"find-up": "^2.1.0",
"loglevel": "^1.4.1",
"lost": "^8.2.0",
"mkdirp": "^0.5.1",
"node-sass": "^4.5.3",
"node-version": "^1.0.0",
"postcss-custom-media": "^6.0.0",
"postcss-discard-duplicates": "^2.1.0",
"postcss-loader": "^2.0.6",
"postcss-unique-selectors": "^2.0.2",
"postcss-zindex": "^2.2.0",
"rimraf": "^2.6.1",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
Expand Down
19 changes: 16 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3359,6 +3359,13 @@ loose-envify@^1.0.0:
dependencies:
js-tokens "^3.0.0"

lost@^8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/lost/-/lost-8.2.0.tgz#107d0733b286029a3587bc1230f98d2a6eb21ef7"
dependencies:
object-assign "^4.1.0"
postcss "^6.0.6"

loud-rejection@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
Expand Down Expand Up @@ -4060,13 +4067,19 @@ postcss-convert-values@^2.3.4:
postcss "^5.0.11"
postcss-value-parser "^3.1.2"

postcss-custom-media@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/postcss-custom-media/-/postcss-custom-media-6.0.0.tgz#be532784110ecb295044fb5395a18006eb21a737"
dependencies:
postcss "^6.0.1"

postcss-discard-comments@^2.0.4:
version "2.0.4"
resolved "https://registry.yarnpkg.com/postcss-discard-comments/-/postcss-discard-comments-2.0.4.tgz#befe89fafd5b3dace5ccce51b76b81514be00e3d"
dependencies:
postcss "^5.0.14"

postcss-discard-duplicates@^2.0.1:
postcss-discard-duplicates@^2.0.1, postcss-discard-duplicates@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/postcss-discard-duplicates/-/postcss-discard-duplicates-2.1.0.tgz#b9abf27b88ac188158a5eb12abcae20263b91932"
dependencies:
Expand Down Expand Up @@ -4290,7 +4303,7 @@ postcss-value-parser@^3.0.1, postcss-value-parser@^3.0.2, postcss-value-parser@^
version "3.3.0"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz#87f38f9f18f774a4ab4c8a232f5c5ce8872a9d15"

postcss-zindex@^2.0.1:
postcss-zindex@^2.0.1, postcss-zindex@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/postcss-zindex/-/postcss-zindex-2.2.0.tgz#d2109ddc055b91af67fc4cb3b025946639d2af22"
dependencies:
Expand All @@ -4307,7 +4320,7 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0
source-map "^0.5.6"
supports-color "^3.2.3"

postcss@^6.0.1, postcss@^6.0.10, postcss@^6.0.2:
postcss@^6.0.1, postcss@^6.0.10, postcss@^6.0.2, postcss@^6.0.6:
version "6.0.10"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.10.tgz#c311b89734483d87a91a56dc9e53f15f4e6e84e4"
dependencies:
Expand Down

0 comments on commit 8423610

Please sign in to comment.