postcss-loader
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -0,1 +1,6 @@ | ||
## 0.6 | ||
* Use PostCSS 5.0. | ||
* Remove `safe` parameter. Use Safe Parser. | ||
* Add `syntax`, `parser` and `stringifier` parameters. | ||
## 0.5.1 | ||
@@ -2,0 +7,0 @@ * Fix string source map support (by Jan Nicklas). |
17
index.js
@@ -11,5 +11,6 @@ var loaderUtils = require('loader-utils'); | ||
var opts = { | ||
from: file, to: file, | ||
map: { | ||
inline: false, | ||
from: file, | ||
to: file, | ||
map: { | ||
inline: false, | ||
annotation: false | ||
@@ -19,9 +20,9 @@ } | ||
if ( typeof map === 'string' ) { | ||
map = JSON.parse(map); | ||
} | ||
if ( typeof map === 'string' ) map = JSON.parse(map); | ||
if ( map && map.mappings ) opts.map.prev = map; | ||
if ( params.safe ) opts.safe = true; | ||
if ( params.syntax ) opts.syntax = require(params.syntax); | ||
if ( params.parser ) opts.parser = require(params.parser); | ||
if ( params.stringifier ) opts.stringifier = require(params.stringifier); | ||
var plugins = this.options.postcss; | ||
@@ -28,0 +29,0 @@ if ( typeof plugins === 'function' ) { |
{ | ||
"name": "postcss-loader", | ||
"version": "0.5.1", | ||
"description": "PostCSS loader for webpack", | ||
"keywords": ["webpack", "loader", "css", "postcss", "postcss-runner"], | ||
"author": "Andrey Sitnik <andrey@sitnik.ru>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/postcss/postcss-loader.git" | ||
}, | ||
"dependencies": { | ||
"loader-utils": "^0.2.10", | ||
"postcss": "^4.1.13" | ||
}, | ||
"devDependencies": { | ||
"gulp-webpack": "1.5.0", | ||
"gulp-eslint": "0.14.0", | ||
"gulp-mocha": "2.1.2", | ||
"raw-loader": "0.5.1", | ||
"fs-extra": "0.20.1", | ||
"chai": "3.0.0", | ||
"gulp": "3.9.0" | ||
}, | ||
"scripts": { | ||
"test": "gulp" | ||
} | ||
"name": "postcss-loader", | ||
"version": "0.6.0", | ||
"description": "PostCSS loader for webpack", | ||
"keywords": ["webpack", "loader", "css", "postcss", "postcss-runner"], | ||
"author": "Andrey Sitnik <andrey@sitnik.ru>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/postcss/postcss-loader.git" | ||
}, | ||
"dependencies": { | ||
"loader-utils": "^0.2.11", | ||
"postcss": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"postcss-safe-parser": "1.0.0", | ||
"webpack-stream": "2.1.0", | ||
"gulp-eslint": "1.0.0", | ||
"gulp-mocha": "2.1.3", | ||
"raw-loader": "0.5.1", | ||
"fs-extra": "0.23.1", | ||
"chai": "3.2.0", | ||
"gulp": "3.9.0" | ||
}, | ||
"scripts": { | ||
"test": "gulp" | ||
} | ||
} |
@@ -13,3 +13,3 @@ # PostCSS for Webpack [![Build Status][ci-img]][ci] | ||
[PostCSS plugins]: https://github.com/postcss/postcss#built-with-postcss | ||
[PostCSS plugins]: https://github.com/postcss/postcss#plugins | ||
[PostCSS]: https://github.com/postcss/postcss | ||
@@ -25,4 +25,4 @@ [webpack]: http://webpack.github.io/ | ||
```js | ||
var autoprefixer = require('autoprefixer-core'); | ||
var csswring = require('csswring'); | ||
var autoprefixer = require('autoprefixer'); | ||
var cssnext = require('cssnext'); | ||
@@ -38,4 +38,4 @@ module.exports = { | ||
}, | ||
postcss: function { | ||
return [autoprefixer, csswring]; | ||
postcss: function () { | ||
return [autoprefixer, cssnext]; | ||
} | ||
@@ -57,4 +57,4 @@ } | ||
... | ||
postcss: function { | ||
return [autoprefixer, csswring]; | ||
postcss: function () { | ||
return [autoprefixer, cssnext]; | ||
} | ||
@@ -90,3 +90,3 @@ } | ||
return { | ||
defaults: [autoprefixer, csswring], | ||
defaults: [autoprefixer, cssnext], | ||
cleaner: [autoprefixer({ browsers: [] })] | ||
@@ -144,9 +144,17 @@ }; | ||
## Safe Mode | ||
## Custom Syntaxes | ||
If you add `?safe=1` to requirement, PostCSS will try to correct any syntax | ||
error that it finds in the CSS. For example, it will parse `a {` as `a {}`. | ||
PostCSS can transforms styles in any syntax, not only in CSS. | ||
There are 3 parameters to control syntax: | ||
* `syntax` accepts module name with `parse` and `stringify` function. | ||
* `parser` accepts module name with input parser function. | ||
* `stringifier` accepts module name with output stringifier function. | ||
For example, you can use [Safe Parser] to find and fix any CSS errors: | ||
```js | ||
var css = require('postcss?safe=1!./broken') | ||
var css = require('postcss?parser=postcss-safe-parser!./broken') | ||
``` | ||
[Safe Parser]: https://github.com/postcss/postcss-safe-parser |
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
13735
48
155
8
3
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@1.0.0(transitive)
+ Addedjs-base64@2.6.4(transitive)
+ Addedpostcss@5.2.18(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.03.2.3(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedes6-promise@2.3.0(transitive)
- Removedjs-base64@2.1.9(transitive)
- Removedpostcss@4.1.16(transitive)
- Removedsource-map@0.4.4(transitive)
Updatedloader-utils@^0.2.11
Updatedpostcss@^5.0.0