Socket
Socket
Sign inDemoInstall

@webpack-blocks/postcss

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webpack-blocks/postcss - npm Package Compare versions

Comparing version 0.4.3 to 1.0.0-alpha

5

CHANGELOG.md
# @webpack-blocks/postcss - Changelog
## 1.0
- Updated for new core API ([#125](https://github.com/andywer/webpack-blocks/issues/125))
- Requires node 6+
## 0.4.3

@@ -4,0 +9,0 @@

71

index.js

@@ -18,6 +18,3 @@ /**

*/
function postcss (plugins, options) {
plugins = plugins || []
options = options || {}
function postcss (plugins = [], options = {}) {
// https://github.com/postcss/postcss-loader#options

@@ -31,42 +28,34 @@ const postcssOptions = Object.assign(

return (context) => Object.assign(
{
module: {
loaders: [
Object.assign({
test: context.fileType('text/css'),
loaders: [ 'style-loader', 'css-loader', 'postcss-loader?' + JSON.stringify(postcssOptions) ]
}, options.exclude ? {
exclude: Array.isArray(options.exclude) ? options.exclude : [ options.exclude ]
} : {})
]
}
},
plugins.length > 0 ? createPostcssPluginsConfig(context.webpack, plugins) : {}
)
}
return (context, util) => prevConfig => {
const ruleDef = Object.assign(
{
test: context.fileType('text/css'),
use: [ 'style-loader', 'css-loader', 'postcss-loader?' + JSON.stringify(postcssOptions) ]
}, options.exclude ? {
exclude: Array.isArray(options.exclude) ? options.exclude : [ options.exclude ]
} : {}
)
function createPostcssPluginsConfig (webpack, plugins) {
const isWebpack2 = typeof webpack.validateSchema !== 'undefined'
const _addLoader = util.addLoader(ruleDef)
const _addPlugin = plugins.length > 0
? addLoaderOptionsPlugin(context, util, plugins)
: config => config
if (isWebpack2) {
return {
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
postcss: plugins,
// Hacky fix for a strange issue involving the postcss-loader, sass-loader and webpack@2
// (see https://github.com/andywer/webpack-blocks/issues/116)
// Might be removed again once the `sass` block uses a newer `sass-loader`
context: '/'
}
})
]
}
} else {
return {
postcss: plugins
}
return _addPlugin(_addLoader(prevConfig))
}
}
function addLoaderOptionsPlugin ({ webpack }, util, postcssPlugins) {
return util.addPlugin(
new webpack.LoaderOptionsPlugin({
options: {
postcss: postcssPlugins,
// Hacky fix for a strange issue involving the postcss-loader, sass-loader and webpack@2
// (see https://github.com/andywer/webpack-blocks/issues/116)
// Might be removed again once the `sass` block uses a newer `sass-loader`
context: '/'
}
})
)
}
{
"name": "@webpack-blocks/postcss",
"version": "0.4.3",
"version": "1.0.0-alpha",
"description": "Webpack block for PostCSS.",

@@ -13,3 +13,3 @@ "main": "lib/index",

"engines": {
"node": ">= 4.0"
"node": ">= 6.0"
},

@@ -16,0 +16,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc