@webpack-blocks/postcss
Advanced tools
Comparing version 0.3.1 to 0.3.2
# @webpack-blocks/postcss - Changelog | ||
## 0.3.2 | ||
- Bug fix: PostCSS plugin configuration now works with webpack 2 ([#68](https://github.com/andywer/webpack-blocks/issues/68)) | ||
## 0.3.1 | ||
@@ -4,0 +8,0 @@ |
41
index.js
@@ -30,15 +30,34 @@ /** | ||
return (context) => Object.assign({ | ||
module: { | ||
loaders: [ | ||
{ | ||
test: context.fileType('text/css'), | ||
exclude: Array.isArray(exclude) ? exclude : [ exclude ], | ||
loaders: [ 'style-loader', 'css-loader', 'postcss-loader?' + JSON.stringify(postcssOptions) ] | ||
} | ||
return (context) => Object.assign( | ||
{ | ||
module: { | ||
loaders: [ | ||
{ | ||
test: context.fileType('text/css'), | ||
exclude: Array.isArray(exclude) ? exclude : [ exclude ], | ||
loaders: [ 'style-loader', 'css-loader', 'postcss-loader?' + JSON.stringify(postcssOptions) ] | ||
} | ||
] | ||
} | ||
}, | ||
plugins ? createPostcssPluginsConfig(context.webpack, plugins) : {} | ||
) | ||
} | ||
function createPostcssPluginsConfig (webpack, plugins) { | ||
const isWebpack2 = typeof webpack.validateSchema !== 'undefined' | ||
if (isWebpack2) { | ||
return { | ||
plugins: [ | ||
new webpack.LoaderOptionsPlugin({ | ||
options: { postcss: plugins } | ||
}) | ||
] | ||
} | ||
}, plugins ? { | ||
postcss: plugins | ||
} : {}) | ||
} else { | ||
return { | ||
postcss: plugins | ||
} | ||
} | ||
} |
{ | ||
"name": "@webpack-blocks/postcss", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Webpack block for PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -23,3 +23,14 @@ # Webpack blocks - PostCSS | ||
Instead of passing the PostCSS plugins as an array you can also create a `postcss.config.js` file containing the plugin configuration (see [PostCSS loader usage](https://github.com/postcss/postcss-loader#usage)): | ||
```js | ||
// postcss.config.js | ||
module.exports = { | ||
plugins: [ | ||
require('precss') | ||
] | ||
} | ||
``` | ||
## Options | ||
@@ -26,0 +37,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4433
56
54