@webpack-blocks/postcss
Advanced tools
Comparing version 0.3.0 to 0.3.1
# @webpack-blocks/postcss - Changelog | ||
## 0.3.1 | ||
- Supporting custom PostCSS options now (`parser`, `stringifier`, `syntax`) | ||
## 0.3.0 | ||
@@ -4,0 +8,0 @@ |
17
index.js
@@ -10,5 +10,8 @@ /** | ||
/** | ||
* @param {PostCSSPlugin[]} [plugins] Will read `postcss.config.js` file if not supplied. | ||
* @param {PostCSSPlugin[]} [plugins] Will read `postcss.config.js` file if not supplied. | ||
* @param {object} [options] | ||
* @param {RegExp, Function, string} [options.exclude] Directories to exclude. | ||
* @param {RegExp|Function|string} [options.exclude] Directories to exclude. | ||
* @param {string} [options.parser] Package name of custom PostCSS parser to use. | ||
* @param {string} [options.stringifier] Package name of custom PostCSS stringifier to use. | ||
* @param {string} [options.syntax] Package name of custom PostCSS parser/stringifier to use. | ||
* @return {Function} | ||
@@ -20,2 +23,10 @@ */ | ||
// https://github.com/postcss/postcss-loader#options | ||
const postcssOptions = Object.assign( | ||
{}, | ||
options.parser && { parser: options.parser }, | ||
options.stringifier && { stringifier: options.stringifier }, | ||
options.syntax && { syntax: options.syntax } | ||
) | ||
return (context) => Object.assign({ | ||
@@ -27,3 +38,3 @@ module: { | ||
exclude: Array.isArray(exclude) ? exclude : [ exclude ], | ||
loaders: [ 'style-loader', 'css-loader', 'postcss-loader' ] | ||
loaders: [ 'style-loader', 'css-loader', 'postcss-loader?' + JSON.stringify(postcssOptions) ] | ||
} | ||
@@ -30,0 +41,0 @@ ] |
{ | ||
"name": "@webpack-blocks/postcss", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Webpack block for PostCSS.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -19,3 +19,3 @@ # Webpack blocks - PostCSS | ||
autoprefixer({ browsers: ['last 2 versions'] }) | ||
]) | ||
], { /* custom PostCSS options */ }) | ||
]) | ||
@@ -25,2 +25,14 @@ ``` | ||
## Options | ||
#### parser *(optional)* | ||
Package name of a custom PostCSS parser to use. Pass for instance `'sugarss'` to be able to write indent-based CSS. | ||
#### stringifier *(optional)* | ||
Package name of a custom PostCSS stringifier to use. | ||
#### syntax *(optional)* | ||
Package name of a custom PostCSS syntax to use. The package must export a `parse` and a `stringify` function. | ||
## Webpack blocks | ||
@@ -27,0 +39,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
3590
39
43