postcss-loader
Advanced tools
Comparing version
@@ -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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
13735
55.97%48
2.13%155
5.44%8
14.29%3
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated