Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-loader

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-loader - npm Package Compare versions

Comparing version 0.4.4 to 0.5.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

## 0.5.0
* Set plugins by function for hot reload support (by Stefano Brilli).
## 0.4.4

@@ -2,0 +5,0 @@ * Fix error on empty PostCSS config.

@@ -21,2 +21,6 @@ var loaderUtils = require('loader-utils');

var plugins = this.options.postcss;
if ( typeof plugins === 'function' ) {
plugins = plugins.call(this);
}
if ( typeof plugins === 'undefined' ) {

@@ -23,0 +27,0 @@ plugins = [];

16

package.json
{
"name": "postcss-loader",
"version": "0.4.4",
"version": "0.5.0",
"description": "PostCSS loader for webpack",

@@ -13,13 +13,13 @@ "keywords": ["webpack", "loader", "css", "postcss", "postcss-runner"],

"dependencies": {
"loader-utils": "^0.2.7",
"loader-utils": "^0.2.10",
"postcss": "^4.1.11"
},
"devDependencies": {
"gulp-webpack": "1.4.0",
"gulp-eslint": "0.12.0",
"gulp-mocha": "2.1.0",
"gulp-webpack": "1.5.0",
"gulp-eslint": "0.14.0",
"gulp-mocha": "2.1.1",
"raw-loader": "0.5.1",
"fs-extra": "0.18.4",
"chai": "2.3.0",
"gulp": "3.8.11"
"fs-extra": "0.19.0",
"chai": "3.0.0",
"gulp": "3.9.0"
},

@@ -26,0 +26,0 @@ "scripts": {

@@ -36,3 +36,5 @@ # PostCSS for Webpack [![Build Status][ci-img]][ci]

},
postcss: [autoprefixer, csswring]
postcss: function {
return [autoprefixer, csswring];
}
}

@@ -48,2 +50,18 @@ ```

Note that the context of this function
```js
module.exports = {
...
postcss: function {
return [autoprefixer, csswring];
}
}
```
will be set to the [webpack loader-context].
If there is the need, this will let you access to webpack loaders API.
[webpack loader-context]: http://webpack.github.io/docs/loaders.html#loader-context
## Plugins Packs

@@ -68,5 +86,7 @@

},
postcss: {
defaults: [autoprefixer, csswring],
cleaner: [autoprefixer({ browsers: [] })]
postcss: function () {
return {
defaults: [autoprefixer, csswring],
cleaner: [autoprefixer({ browsers: [] })]
};
}

@@ -76,3 +96,48 @@ }

## Integration with postcss-import
When using [postcss-import] plugin, you may want to tell webpack about
dependencies coming from your `@import` directives.
For example: in watch mode, to enable recompile on change.
Since the function in postcss section is executed with
the [webpack loader-context], we can use the postcss-import callback
[onImport] to tell webpack what files need to be watched.
```js
var cssimport = require('postcss-import');
var autoprefixer = require('autoprefixer-core');
module.exports = {
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader!postcss-loader"
}
]
},
postcss: function () {
// The context of this function is the webpack loader-context
// see: http://webpack.github.io/docs/loaders.html#loader-context
return [
cssimport({
// see postcss-import docs to learn about onImport callback
// https://github.com/postcss/postcss-import
onImport: function (files) {
files.forEach(this.addDependency);
}.bind(this)
}),
autoprefixer
];
}
}
```
[webpack loader-context]: http://webpack.github.io/docs/loaders.html#loader-context
[postcss-import]: https://github.com/postcss/postcss-import
[onImport]: https://github.com/postcss/postcss-import#onimport
## Safe Mode

@@ -79,0 +144,0 @@

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