postcss 2.2.5 → 2.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/ChangeLog.md +4 -1
- package/README.md +100 -43
- package/lib/map-generator.js +7 -5
- package/lib/previous-map.js +1 -1
- package/package.json +2 -2
package/ChangeLog.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
## 2.2.6
|
2
|
+
* Fix map generation for nodes without source (by Josiah Savary).
|
3
|
+
|
1
4
|
## 2.2.5
|
2
|
-
* Fix source map with
|
5
|
+
* Fix source map with BOM marker support (by Mohammad Younes).
|
3
6
|
* Fix source map paths (by Mohammad Younes).
|
4
7
|
|
5
8
|
## 2.2.4
|
package/README.md
CHANGED
@@ -28,50 +28,60 @@ Sponsored by [Evil Martians](http://evilmartians.com/).
|
|
28
28
|
### Tools
|
29
29
|
|
30
30
|
* [Autoprefixer] adds vendor prefixes by Can I Use data.
|
31
|
+
* [BEM linter] lints CSS for SUIT CSS methodology.
|
31
32
|
* [CSS MQPacker] joins same media queries.
|
32
33
|
* [css2modernizr] analyzes your CSS and output only used Modernizr’s settings.
|
33
|
-
* [cssnext] is a transpiler (CSS4+ to CSS3) that allow you to use tomorrow’s
|
34
|
-
|
34
|
+
* [cssnext] is a transpiler (CSS4+ to CSS3) that allow you to use tomorrow’s
|
35
|
+
CSS syntax today.
|
36
|
+
* [CSSWring] is a CSS minifier with full source map support.
|
35
37
|
* [data-separator] splits data-uri into a separate CSS file.
|
36
|
-
* [pixrem]
|
37
|
-
* [
|
38
|
+
* [pixrem] is a `rem` unit polyfill.
|
39
|
+
* [webpcss] to duplicate images in CSS to WebP for supported browsers.
|
38
40
|
* [Pleeease] is a pack of various postprocessors.
|
39
41
|
* [Pleeease Filters] converts WebKit filters to SVG filter for other browsers.
|
40
42
|
* [RTLCSS] mirrors styles for right-to-left locales.
|
41
|
-
|
42
|
-
|
43
|
-
[
|
44
|
-
[
|
45
|
-
[
|
46
|
-
[
|
47
|
-
[
|
48
|
-
[
|
49
|
-
[
|
50
|
-
[
|
51
|
-
[
|
52
|
-
[Pleeease]:
|
53
|
-
[Pleeease Filters]:
|
54
|
-
[RTLCSS]:
|
43
|
+
* [CSS Byebye] explicitly removes the CSS rules that you don't want.
|
44
|
+
|
45
|
+
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
46
|
+
[BEM linter]: https://github.com/necolas/postcss-bem-linter
|
47
|
+
[CSS MQPacker]: https://github.com/hail2u/node-css-mqpacker
|
48
|
+
[css2modernizr]: https://github.com/vovanbo/css2modernizr
|
49
|
+
[cssnext]: https://github.com/putaindecode/cssnext
|
50
|
+
[CSSWring]: https://github.com/hail2u/node-csswring
|
51
|
+
[data-separator]: https://github.com/Sebastian-Fitzner/grunt-data-separator
|
52
|
+
[pixrem]: https://github.com/robwierzbowski/node-pixrem
|
53
|
+
[webpcss]: https://github.com/lexich/webpcss
|
54
|
+
[Pleeease]: http://pleeease.io/
|
55
|
+
[Pleeease Filters]: https://github.com/iamvdo/pleeease-filters
|
56
|
+
[RTLCSS]: https://github.com/MohammadYounes/rtlcss
|
57
|
+
[CSS Byebye]: https://github.com/AoDev/css-byebye
|
55
58
|
|
56
59
|
### Plugins
|
57
60
|
|
58
61
|
* [postcss-calc] to reduce `calc()` usage
|
59
62
|
(recommanded with `postcss-custom-properties`).
|
60
|
-
* [postcss-color] to transform
|
61
|
-
|
62
|
-
* [postcss-
|
63
|
-
|
64
|
-
|
65
|
-
* [postcss-
|
66
|
-
|
63
|
+
* [postcss-color-function] to transform `color()` function.
|
64
|
+
* [postcss-color-gray] to transform `gray()` function.
|
65
|
+
* [postcss-color-hex-alpha] to transform hexadecimal notations with alpha
|
66
|
+
(`#rrggbbaa` or `#rgba`).
|
67
|
+
* [postcss-color-hwb] to transform `hwb()` function.
|
68
|
+
* [postcss-color-rebeccapurple] to transform `rebeccapurple` color.
|
69
|
+
* [postcss-import] to transform `@import` rules by inlining content.
|
70
|
+
* [postcss-custom-media] to add names for Media Queries.
|
71
|
+
* [postcss-custom-properties] to transform Custom Properties
|
72
|
+
for cascading variables.
|
67
73
|
* [postcss-url] to rebase or inline on `url()`.
|
68
74
|
|
69
|
-
[postcss-calc]:
|
70
|
-
[postcss-color]:
|
71
|
-
[postcss-
|
72
|
-
[postcss-
|
73
|
-
[postcss-
|
74
|
-
[postcss-
|
75
|
+
[postcss-calc]: https://github.com/postcss/postcss-calc
|
76
|
+
[postcss-color-function]: https://github.com/postcss/postcss-color-function
|
77
|
+
[postcss-color-gray]: https://github.com/postcss/postcss-color-gray
|
78
|
+
[postcss-color-hex-alpha]: https://github.com/postcss/postcss-color-hex-alpha
|
79
|
+
[postcss-color-hwb]: https://github.com/postcss/postcss-color-hwb
|
80
|
+
[postcss-color-rebeccapurple]: https://github.com/postcss/postcss-color-rebeccapurple
|
81
|
+
[postcss-import]: https://github.com/postcss/postcss-import
|
82
|
+
[postcss-custom-media]: https://github.com/postcss/postcss-custom-media
|
83
|
+
[postcss-custom-properties]: https://github.com/postcss/postcss-custom-properties
|
84
|
+
[postcss-url]: https://github.com/postcss/postcss-url
|
75
85
|
|
76
86
|
|
77
87
|
## Quick Example
|
@@ -234,24 +244,46 @@ Because of this fundamental difference, PostCSS:
|
|
234
244
|
|
235
245
|
## Usage
|
236
246
|
|
247
|
+
### Grunt
|
248
|
+
|
249
|
+
Grunt plugin [grunt-postcss] allows you to pipe your CSS files through
|
250
|
+
an array of PostCSS processors.
|
251
|
+
|
252
|
+
```js
|
253
|
+
grunt.initConfig({
|
254
|
+
postcss: {
|
255
|
+
options: {
|
256
|
+
map: true,
|
257
|
+
processors: [
|
258
|
+
require('autoprefixer-core').postcss,
|
259
|
+
require('csswring').postcss
|
260
|
+
]
|
261
|
+
},
|
262
|
+
dist: {
|
263
|
+
src: 'css/*.css'
|
264
|
+
}
|
265
|
+
}
|
266
|
+
});
|
267
|
+
|
268
|
+
grunt.loadNpmTasks('grunt-postcss');
|
269
|
+
```
|
270
|
+
|
271
|
+
[grunt-postcss]: https://github.com/nDmitry/grunt-postcss
|
272
|
+
|
237
273
|
### Gulp
|
238
274
|
|
239
|
-
There is a
|
240
|
-
|
241
|
-
that allows you to pipe your CSS files through an array of PostCSS processors.
|
275
|
+
There is a Gulp plugin for PostCSS called [gulp-postcss] that allows you
|
276
|
+
to pipe your CSS files through an array of PostCSS processors.
|
242
277
|
|
243
|
-
Support for external source maps is provided by
|
244
|
-
by [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps).
|
278
|
+
Support for external source maps is provided by [gulp-sourcemaps].
|
245
279
|
|
246
280
|
```js
|
247
|
-
var gulp = require('gulp');
|
248
281
|
var postcss = require('gulp-postcss');
|
249
282
|
var sourcemaps = require('gulp-sourcemaps');
|
250
283
|
|
251
284
|
gulp.task('css', function () {
|
252
285
|
var processors = [
|
253
|
-
require('autoprefixer')
|
254
|
-
require('css-mqpacker'),
|
286
|
+
require('autoprefixer-core'),
|
255
287
|
require('csswring')
|
256
288
|
];
|
257
289
|
return gulp.src('./src/style.css')
|
@@ -262,6 +294,31 @@ gulp.task('css', function () {
|
|
262
294
|
});
|
263
295
|
```
|
264
296
|
|
297
|
+
[gulp-postcss]: https://github.com/w0rm/gulp-postcss
|
298
|
+
[gulp-sourcemaps]: https://github.com/floridoo/gulp-sourcemaps
|
299
|
+
|
300
|
+
### Webpack
|
301
|
+
|
302
|
+
In [webpack] you can use [postcss-loader] to process CSS files through
|
303
|
+
an array of PostCSS processors.
|
304
|
+
|
305
|
+
```js
|
306
|
+
module.exports = {
|
307
|
+
module: {
|
308
|
+
loaders: [
|
309
|
+
{
|
310
|
+
test: /\.css$/,
|
311
|
+
loader: "style-loader!css-loader!postcss-loader"
|
312
|
+
}
|
313
|
+
]
|
314
|
+
},
|
315
|
+
postcss: [require('autoprefixer-core'), require('csswring')]
|
316
|
+
}
|
317
|
+
```
|
318
|
+
|
319
|
+
[postcss-loader]: https://github.com/postcss/postcss-loader
|
320
|
+
[webpack]: http://webpack.github.io/
|
321
|
+
|
265
322
|
## Write Own Processor
|
266
323
|
|
267
324
|
You can parse CSS with the `postcss.parse()` method, which returns a CSS AST:
|
@@ -857,10 +914,10 @@ var comment = postcss.comment({ text: 'New comment' });
|
|
857
914
|
|
858
915
|
`AtRule` has two own properties: `name` and `params`.
|
859
916
|
|
860
|
-
As illustrated above, some at-rules do not contain any children
|
917
|
+
As illustrated above, some at-rules do not contain any children
|
861
918
|
(for example, `@charset` or `@import`), some at-rules can only contain
|
862
|
-
declarations (for example, `@font-face` or `@page`), but most of them
|
863
|
-
can contain rules and nested at-rules (for example, `@media`, `@keyframes`
|
919
|
+
declarations (for example, `@font-face` or `@page`), but most of them
|
920
|
+
can contain rules and nested at-rules (for example, `@media`, `@keyframes`
|
864
921
|
and others).
|
865
922
|
|
866
923
|
The parser selects `AtRule` content type by its name. If you create an `AtRule`
|
@@ -891,7 +948,7 @@ a {
|
|
891
948
|
}
|
892
949
|
```
|
893
950
|
|
894
|
-
`Rule` nodes have a `selector` property and contain their `Declaration`
|
951
|
+
`Rule` nodes have a `selector` property and contain their `Declaration`
|
895
952
|
and `Comment` children within the `decls` property.
|
896
953
|
|
897
954
|
They also possess a `selectors` shortcut, which returns an array:
|
package/lib/map-generator.js
CHANGED
@@ -68,11 +68,13 @@ var MapGenerator = (function(){"use strict";var PRS$0 = (function(o,t){o["__prot
|
|
68
68
|
proto$0.setSourcesContent = function() {var this$0 = this;
|
69
69
|
var already = { };
|
70
70
|
this.root.eachInside( function(node) {
|
71
|
-
|
72
|
-
|
73
|
-
already[file]
|
74
|
-
|
75
|
-
|
71
|
+
if ( node.source ) {
|
72
|
+
var file = node.source.file || node.source.id;
|
73
|
+
if ( file && !already[file] ) {
|
74
|
+
already[file] = true;
|
75
|
+
var relative = this$0.relative(file);
|
76
|
+
this$0.map.setSourceContent(relative, node.source.content);
|
77
|
+
}
|
76
78
|
}
|
77
79
|
});
|
78
80
|
};
|
package/lib/previous-map.js
CHANGED
@@ -59,7 +59,7 @@ var PreviousMap = (function(){"use strict";var PRS$0 = (function(o,t){o["__proto
|
|
59
59
|
return Base64.decode( text.substr(base64.length) );
|
60
60
|
|
61
61
|
} else {
|
62
|
-
var encoding = text.match(/
|
62
|
+
var encoding = text.match(/data:application\/json;([^,]+),/)[1];
|
63
63
|
throw new Error('Unsupported source map encoding ' + encoding);
|
64
64
|
}
|
65
65
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "postcss",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.6",
|
4
4
|
"description": "Framework for CSS postprocessors with full source map support",
|
5
5
|
"keywords": ["css", "parser", "postproccessor", "source map"],
|
6
6
|
"author": "Andrey Sitnik <andrey@sitnik.ru>",
|
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/postcss/postcss.git"
|
11
11
|
},
|
12
12
|
"dependencies": {
|
13
|
-
"source-map": "~0.1.
|
13
|
+
"source-map": "~0.1.40",
|
14
14
|
"js-base64": "~2.1.5"
|
15
15
|
},
|
16
16
|
"devDependencies": {
|