postcss 4.1.12 → 4.1.16

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 CHANGED
@@ -1,3 +1,15 @@
1
+ ## 4.1.16
2
+ * Fix errors without stack trace.
3
+
4
+ ## 4.1.15
5
+ * Allow asynchronous plugins to change processor plugins list (by Ben Briggs).
6
+
7
+ ## 4.1.14
8
+ * Fix for plugins packs defined by `postcss.plugin`.
9
+
10
+ ## 4.1.13
11
+ * Fix input inlined source maps with UTF-8 encoding.
12
+
1
13
  ## 4.1.12
2
14
  * Update Promise polyfill.
3
15
 
package/README.md CHANGED
@@ -50,11 +50,11 @@ You can use the [cssnext] plugin pack and write future CSS code right now:
50
50
  @custom-media --mobile (width <= 640px);
51
51
  @custom-selector --heading h1, h2, h3, h4, h5, h6;
52
52
 
53
- .post-article --heading {
53
+ .post-article :--heading {
54
54
  color: color( var(--mainColor) blackness(+20%) );
55
55
  }
56
56
  @media (--mobile) {
57
- .post-article --heading {
57
+ .post-article :--heading {
58
58
  margin-top: 0;
59
59
  }
60
60
  }
@@ -134,26 +134,28 @@ postcss([ require('cssnext')(), require('cssnano')() ])
134
134
  });
135
135
  ```
136
136
 
137
- You can also use PostCSS plugins with the Stylus preprocessor by using [`poststylus`]
137
+ You can also use PostCSS plugins with the Stylus by using [`poststylus`].
138
138
 
139
139
  Read the [PostCSS API] for more details about the JS API.
140
140
 
141
141
  [`poststylus`]: https://github.com/seaneking/poststylus
142
142
  [PostCSS API]: https://github.com/postcss/postcss/blob/master/docs/api.md
143
- [CLI tool]: https://github.com/code42day/postcss-cli
144
143
  [Broccoli]: https://github.com/jeffjewiss/broccoli-postcss
144
+ [CLI tool]: https://github.com/code42day/postcss-cli
145
145
  [webpack]: https://github.com/postcss/postcss-loader
146
- [ENB]: https://github.com/theprotein/enb-postcss
147
146
  [Brunch]: https://github.com/iamvdo/postcss-brunch
148
147
  [Grunt]: https://github.com/nDmitry/grunt-postcss
149
148
  [Gulp]: https://github.com/postcss/gulp-postcss
149
+ [ENB]: https://github.com/theprotein/enb-postcss
150
150
 
151
151
  ## Plugins
152
152
 
153
153
  ### Control
154
154
 
155
- With [`postcss-plugin-context`] you can run different plugins
156
- on different parts of CSS.
155
+ There is two way to make PostCSS magic more explicit.
156
+
157
+ Define a plugins contexts and switch between them in different parts of CSS
158
+ by [`postcss-plugin-context`]:
157
159
 
158
160
  ```css
159
161
  .css-example.is-test-for-css4-browsers {
@@ -166,14 +168,25 @@ on different parts of CSS.
166
168
  }
167
169
  ```
168
170
 
171
+ Or to enable plugins right in CSS by [`postcss-use`]:
172
+
173
+ ```css
174
+ @use autoprefixer(browsers: ['last 2 versions']);
175
+
176
+ :fullscreen a {
177
+ display: flex
178
+ }
179
+ ```
180
+
169
181
  [`postcss-plugin-context`]: https://github.com/postcss/postcss-plugin-context
182
+ [`postcss-use`]: https://github.com/postcss/postcss-use
170
183
 
171
184
  ### Packs
172
185
 
173
- * [`cssnano`] contains plugins that optimize CSS size for use in production.
174
- * [`cssnext`] contains plugins that allow you to use future CSS features today.
175
186
  * [`atcss`] contains plugins that transform your CSS according
176
187
  to special annotation comments.
188
+ * [`cssnano`] contains plugins that optimize CSS size for use in production.
189
+ * [`cssnext`] contains plugins that allow you to use future CSS features today.
177
190
 
178
191
  [`cssnano`]: https://github.com/ben-eb/cssnano
179
192
  [`cssnext`]: http://cssnext.io/
@@ -186,13 +199,15 @@ on different parts of CSS.
186
199
  * [`postcss-color-hex-alpha`] supports `#rrggbbaa` and `#rgba` notation.
187
200
  * [`postcss-color-hwb`] transforms `hwb()` to widely compatible `rgb()`.
188
201
  * [`postcss-color-rebeccapurple`] supports the `rebeccapurple` color.
202
+ * [`postcss-conic-gradient`] supports the `conic-gradient` background.
203
+ * [`postcss-css-variables`] supports variables for nested rules,
204
+ selectors, and at-rules
189
205
  * [`postcss-custom-media`] supports custom aliases for media queries.
190
206
  * [`postcss-custom-properties`] supports variables, using syntax from
191
207
  the W3C Custom Properties.
192
- * [`postcss-css-variables`] supports variables for descendant/nested rules, pseudo selectors, and at-rules
193
208
  * [`postcss-custom-selectors`] adds custom aliases for selectors.
194
- * [`postcss-font-variant`] transpiles human-readable `font-variant` to more
195
- widely supported CSS.
209
+ * [`postcss-font-variant`] transpiles human-readable `font-variant`
210
+ to more widely supported CSS.
196
211
  * [`postcss-host`] makes the Shadow DOM’s `:host` selector work properly
197
212
  with pseudo-classes.
198
213
  * [`postcss-media-minmax`] adds `<=` and `=>` statements to media queries.
@@ -200,13 +215,14 @@ on different parts of CSS.
200
215
  * [`postcss-selector-not`] transforms CSS4 `:not()` to CSS3 `:not()`.
201
216
  * [`mq4-hover-shim`] supports the `@media (hover)` feature.
202
217
 
203
- See also [`cssnext`] plugins pack to add Future CSS syntax by one line of code.
218
+ See also [`cssnext`] plugins pack to add future CSS syntax by one line of code.
204
219
 
205
220
  ### Fallbacks
206
221
 
207
222
  * [`postcss-color-rgba-fallback`] transforms `rgba()` to hexadecimal.
208
223
  * [`postcss-epub`] adds the `-epub-` prefix to relevant properties.
209
- * [`postcss-image-set`] adds `background-image` with first image for `image-set()`
224
+ * [`postcss-image-set`] adds `background-image` with first image
225
+ for `image-set()`.
210
226
  * [`postcss-opacity`] adds opacity filter for IE8.
211
227
  * [`postcss-pseudoelements`] Convert `::` selectors into `:` selectors
212
228
  for IE 8 compatibility.
@@ -220,12 +236,15 @@ See also [`cssnext`] plugins pack to add Future CSS syntax by one line of code.
220
236
  ### Language Extensions
221
237
 
222
238
  * [`postcss-bem`] adds at-rules for BEM and SUIT style classes.
239
+ * [`postcss-conditionals`] adds `@if` statements.
240
+ * [`postcss-define-property`] to define properties shortcut.
223
241
  * [`postcss-each`] adds `@each` statement.
224
242
  * [`postcss-for`] adds `@for` loops.
225
- * [`postcss-conditionals`] adds `@if` statements.
243
+ * [`postcss-map`] enables configuration maps.
226
244
  * [`postcss-mixins`] enables mixins more powerful than Sass’s,
227
245
  defined within stylesheets or in JS.
228
- * [`postcss-map`] enables configuration maps.
246
+ * [`postcss-media-variables`] adds support for `var()` and `calc()`
247
+ in `@media` rules
229
248
  * [`postcss-modular-scale`] adds a modular scale `ms()` function.
230
249
  * [`postcss-nested`] unwraps nested rules.
231
250
  * [`postcss-pseudo-class-enter`] transforms `:enter` into `:hover` and `:focus`.
@@ -233,6 +252,7 @@ See also [`cssnext`] plugins pack to add Future CSS syntax by one line of code.
233
252
  * [`postcss-simple-extend`] supports extending of silent classes,
234
253
  like Sass’s `@extend`.
235
254
  * [`postcss-simple-vars`] supports for Sass-style variables.
255
+ * [`postcss-strip-units`] strips units off of property values.
236
256
  * [`postcss-vertical-rhythm`] adds a vertical rhythm unit
237
257
  based on `font-size` and `line-height`.
238
258
  * [`csstyle`] adds components workflow to your styles.
@@ -241,12 +261,13 @@ See also [`cssnext`] plugins pack to add Future CSS syntax by one line of code.
241
261
 
242
262
  * [`postcss-brand-colors`] inserts company brand colors
243
263
  in the `brand-colors` module.
244
- * [`postcss-color-mix`] mixes two colors together.
245
264
  * [`postcss-color-alpha`] transforms `#hex.a`, `black(alpha)` and `white(alpha)`
246
265
  to `rgba()`.
247
266
  * [`postcss-color-hcl`] transforms `hcl(H, C, L)` and `HCL(H, C, L, alpha)`
248
267
  to `#rgb` and `rgba()`.
268
+ * [`postcss-color-mix`] mixes two colors together.
249
269
  * [`postcss-color-palette`] transforms CSS 2 color keywords to a custom palette.
270
+ * [`postcss-color-pantone`] transforms pantone color to RGB.
250
271
  * [`postcss-color-scale`] adds a color scale `cs()` function.
251
272
  * [`postcss-hexrgba`] adds shorthand hex `rgba(hex, alpha)` method.
252
273
 
@@ -278,17 +299,22 @@ See also plugins in modular minifier [`cssnano`].
278
299
 
279
300
  ### Shortcuts
280
301
 
302
+ * [`postcss-alias`] to create shorter aliases for properties.
303
+ * [`postcss-border`] adds shorthand for width and color of all borders
304
+ in `border` property.
281
305
  * [`postcss-clearfix`] adds `fix` and `fix-legacy` properties to the `clear`
282
306
  declaration.
283
307
  * [`postcss-default-unit`] adds default unit to numeric CSS properties.
284
308
  * [`postcss-easings`] replaces easing names from easings.net
285
309
  with `cubic-bezier()` functions.
286
310
  * [`postcss-focus`] adds `:focus` selector to every `:hover`.
311
+ * [`postcss-fontpath`] adds font links for different browsers.
287
312
  * [`postcss-generate-preset`] allows quick generation of rules.
288
313
  Useful for creating repetitive utilities.
289
314
  * [`postcss-position`] adds shorthand declarations for position attributes.
290
315
  * [`postcss-property-lookup`] allows referencing property values without
291
316
  a variable.
317
+ * [`postcss-short`] adds and extends numerous shorthand properties.
292
318
  * [`postcss-size`] adds a `size` shortcut that sets width and height
293
319
  with one declaration.
294
320
  * [`postcss-verthorz`] adds vertical and horizontal spacing declarations.
@@ -308,6 +334,7 @@ See also plugins in modular minifier [`cssnano`].
308
334
  * [`postcss-pxtorem`] converts pixel units to `rem`.
309
335
  * [`postcss-style-guide`] generates a style guide automatically.
310
336
  * [`rtlcss`] mirrors styles for right-to-left locales.
337
+ * [`stylehacks`] removes CSS hacks based on browser support.
311
338
 
312
339
  ### Analysis
313
340
 
@@ -323,109 +350,121 @@ See also plugins in modular minifier [`cssnano`].
323
350
 
324
351
  * [`postcss-australian-stylesheets`] Australian Style Sheets.
325
352
  * [`postcss-canadian-stylesheets`] Canadian Style Sheets.
353
+ * [`postcss-pointer`] Replaces `pointer: cursor` with `cursor: pointer`.
326
354
  * [`postcss-spiffing`] lets you use British English in your CSS.
327
355
 
328
356
  [`postcss-australian-stylesheets`]: https://github.com/dp-lewis/postcss-australian-stylesheets
329
357
  [`postcss-pseudo-class-any-link`]: https://github.com/jonathantneal/postcss-pseudo-class-any-link
330
358
  [`postcss-canadian-stylesheets`]: https://github.com/chancancode/postcss-canadian-stylesheets
331
- [`postcss-color-rgba-fallback`]: https://github.com/postcss/postcss-color-rgba-fallback
332
359
  [`postcss-color-rebeccapurple`]: https://github.com/postcss/postcss-color-rebeccapurple
360
+ [`postcss-color-rgba-fallback`]: https://github.com/postcss/postcss-color-rgba-fallback
333
361
  [`postcss-discard-duplicates`]: https://github.com/ben-eb/postcss-discard-duplicates
334
362
  [`postcss-minify-font-weight`]: https://github.com/ben-eb/postcss-minify-font-weight
335
363
  [`postcss-pseudo-class-enter`]: https://github.com/jonathantneal/postcss-pseudo-class-enter
336
- [`postcss-discard-font-face`]: https://github.com/ben-eb/postcss-discard-font-face
337
364
  [`postcss-custom-properties`]: https://github.com/postcss/postcss-custom-properties
365
+ [`postcss-discard-font-face`]: https://github.com/ben-eb/postcss-discard-font-face
338
366
  [`postcss-custom-selectors`]: https://github.com/postcss/postcss-custom-selectors
339
367
  [`postcss-discard-comments`]: https://github.com/ben-eb/postcss-discard-comments
340
368
  [`postcss-minify-selectors`]: https://github.com/ben-eb/postcss-minify-selectors
341
369
  [`postcss-quantity-queries`]: https://github.com/pascalduez/postcss-quantity-queries
342
- [`postcss-generate-preset`]: https://github.com/simonsmith/postcss-generate-preset
343
370
  [`postcss-color-hex-alpha`]: https://github.com/postcss/postcss-color-hex-alpha
371
+ [`postcss-define-property`]: https://github.com/daleeidd/postcss-define-property
372
+ [`postcss-generate-preset`]: https://github.com/simonsmith/postcss-generate-preset
373
+ [`postcss-media-variables`]: https://github.com/WolfgangKluge/postcss-media-variables
344
374
  [`postcss-property-lookup`]: https://github.com/simonsmith/postcss-property-lookup
345
375
  [`postcss-vertical-rhythm`]: https://github.com/markgoodyear/postcss-vertical-rhythm
346
376
  [`postcss-color-function`]: https://github.com/postcss/postcss-color-function
377
+ [`postcss-conic-gradient`]: https://github.com/jonathantneal/postcss-conic-gradient
347
378
  [`postcss-convert-values`]: https://github.com/ben-eb/postcss-convert-values
348
379
  [`postcss-pseudoelements`]: https://github.com/axa-ch/postcss-pseudoelements
349
380
  [`postcss-single-charset`]: https://github.com/hail2u/postcss-single-charset
350
- [`postcss-normalize-url`]: https://github.com/ben-eb/postcss-normalize-url
351
381
  [`postcss-color-palette`]: https://github.com/zaim/postcss-color-palette
382
+ [`postcss-color-pantone`]: https://github.com/longdog/postcss-color-pantone
383
+ [`postcss-css-variables`]: https://github.com/MadLittleMods/postcss-css-variables
352
384
  [`postcss-discard-empty`]: https://github.com/ben-eb/postcss-discard-empty
385
+ [`postcss-gradientfixer`]: https://github.com/hallvors/postcss-gradientfixer
386
+ [`postcss-modular-scale`]: https://github.com/kristoferjoseph/postcss-modular-scale
387
+ [`postcss-normalize-url`]: https://github.com/ben-eb/postcss-normalize-url
353
388
  [`postcss-reduce-idents`]: https://github.com/ben-eb/postcss-reduce-idents
354
389
  [`postcss-simple-extend`]: https://github.com/davidtheclark/postcss-simple-extend
355
- [`postcss-css-variables`]: https://github.com/MadLittleMods/postcss-css-variables
356
- [`postcss-modular-scale`]: https://github.com/kristoferjoseph/postcss-modular-scale
357
- [`postcss-gradientfixer`]: https://github.com/hallvors/postcss-gradientfixer
390
+ [`postcss-brand-colors`]: https://github.com/postcss/postcss-brand-colors
391
+ [`postcss-class-prefix`]: https://github.com/thompsongl/postcss-class-prefix
358
392
  [`postcss-conditionals`]: https://github.com/andyjansson/postcss-conditionals
359
- [`postcss-selector-not`]: https://github.com/postcss/postcss-selector-not
393
+ [`postcss-custom-media`]: https://github.com/postcss/postcss-custom-media
360
394
  [`postcss-default-unit`]: https://github.com/antyakushev/postcss-default-unit
395
+ [`postcss-flexboxfixer`]: https://github.com/hallvors/postcss-flexboxfixer
396
+ [`postcss-font-variant`]: https://github.com/postcss/postcss-font-variant
397
+ [`postcss-log-warnings`]: https://github.com/davidtheclark/postcss-log-warnings
361
398
  [`postcss-media-minmax`]: https://github.com/postcss/postcss-media-minmax
362
399
  [`postcss-merge-idents`]: https://github.com/ben-eb/postcss-merge-idents
363
- [`postcss-custom-media`]: https://github.com/postcss/postcss-custom-media
364
- [`postcss-log-warnings`]: https://github.com/davidtheclark/postcss-log-warnings
365
- [`postcss-brand-colors`]: https://github.com/postcss/postcss-brand-colors
366
- [`postcss-font-variant`]: https://github.com/postcss/postcss-font-variant
367
- [`postcss-class-prefix`]: https://github.com/thompsongl/postcss-class-prefix
368
- [`postcss-flexboxfixer`]: https://github.com/hallvors/postcss-flexboxfixer
369
- [`postcss-style-guide`]: https://github.com/morishitter/postcss-style-guide
400
+ [`postcss-selector-not`]: https://github.com/postcss/postcss-selector-not
401
+ [`postcss-color-alpha`]: https://github.com/avanes/postcss-color-alpha
370
402
  [`postcss-color-scale`]: https://github.com/kristoferjoseph/postcss-color-scale
371
- [`postcss-will-change`]: https://github.com/postcss/postcss-will-change
372
- [`postcss-merge-rules`]: https://github.com/ben-eb/postcss-merge-rules
373
- [`postcss-simple-vars`]: https://github.com/postcss/postcss-simple-vars
374
403
  [`postcss-data-packer`]: https://github.com/Ser-Gen/postcss-data-packer
375
404
  [`postcss-font-family`]: https://github.com/ben-eb/postcss-font-family
376
- [`postcss-color-alpha`]: https://github.com/avanes/postcss-color-alpha
405
+ [`postcss-merge-rules`]: https://github.com/ben-eb/postcss-merge-rules
406
+ [`postcss-simple-vars`]: https://github.com/postcss/postcss-simple-vars
407
+ [`postcss-strip-units`]: https://github.com/whitneyit/postcss-strip-units
408
+ [`postcss-style-guide`]: https://github.com/morishitter/postcss-style-guide
409
+ [`postcss-will-change`]: https://github.com/postcss/postcss-will-change
377
410
  [`postcss-bem-linter`]: https://github.com/necolas/postcss-bem-linter
378
411
  [`postcss-color-gray`]: https://github.com/postcss/postcss-color-gray
379
412
  [`postcss-colorblind`]: https://github.com/btholt/postcss-colorblind
380
413
  [`postcss-color-hcl`]: https://github.com/devgru/postcss-color-hcl
381
- [`postcss-color-mix`]: https://github.com/iamstarkov/postcss-color-mix
382
414
  [`postcss-color-hwb`]: https://github.com/postcss/postcss-color-hwb
415
+ [`postcss-color-mix`]: https://github.com/iamstarkov/postcss-color-mix
383
416
  [`postcss-image-set`]: https://github.com/alex499/postcss-image-set
384
- [`postcss-verthorz`]: https://github.com/davidhemphill/postcss-verthorz
417
+ [`postcss-clearfix`]: https://github.com/seaneking/postcss-clearfix
385
418
  [`postcss-colormin`]: https://github.com/ben-eb/colormin
386
- [`pleeease-filters`]: https://github.com/iamvdo/pleeease-filters
387
- [`postcss-messages`]: https://github.com/postcss/postcss-messages
388
- [`postcss-spiffing`]: https://github.com/HashanP/postcss-spiffing
389
419
  [`postcss-cssstats`]: https://github.com/cssstats/postcss-cssstats
420
+ [`postcss-messages`]: https://github.com/postcss/postcss-messages
390
421
  [`postcss-position`]: https://github.com/seaneking/postcss-position
391
- [`postcss-clearfix`]: https://github.com/seaneking/postcss-clearfix
422
+ [`postcss-spiffing`]: https://github.com/HashanP/postcss-spiffing
423
+ [`postcss-verthorz`]: https://github.com/davidhemphill/postcss-verthorz
424
+ [`pleeease-filters`]: https://github.com/iamvdo/pleeease-filters
425
+ [`postcss-fontpath`]: https://github.com/seaneking/postcss-fontpath
392
426
  [`postcss-easings`]: https://github.com/postcss/postcss-easings
427
+ [`postcss-hexrgba`]: https://github.com/seaneking/postcss-hexrgba
393
428
  [`postcss-opacity`]: https://github.com/iamvdo/postcss-opacity
394
- [`postcss-sprites`]: https://github.com/2createStudio/postcss-sprites
429
+ [`postcss-pointer`]: https://github.com/markgoodyear/postcss-pointer
395
430
  [`postcss-pxtorem`]: https://github.com/cuth/postcss-pxtorem
396
- [`postcss-hexrgba`]: https://github.com/seaneking/postcss-hexrgba
431
+ [`postcss-sprites`]: https://github.com/2createStudio/postcss-sprites
397
432
  [`postcss-assets`]: https://github.com/borodean/postcss-assets
433
+ [`postcss-border`]: https://github.com/andrepolischuk/postcss-border
434
+ [`postcss-fakeid`]: https://github.com/pathsofdesign/postcss-fakeid
398
435
  [`postcss-import`]: https://github.com/postcss/postcss-import
436
+ [`postcss-mixins`]: https://github.com/postcss/postcss-mixins
399
437
  [`postcss-nested`]: https://github.com/postcss/postcss-nested
400
438
  [`postcss-zindex`]: https://github.com/ben-eb/postcss-zindex
401
- [`postcss-fakeid`]: https://github.com/pathsofdesign/postcss-fakeid
402
- [`postcss-mixins`]: https://github.com/postcss/postcss-mixins
403
- [`mq4-hover-shim`]: https://github.com/twbs/mq4-hover-shim
404
439
  [`list-selectors`]: https://github.com/davidtheclark/list-selectors
405
- [`css2modernizr`]: https://github.com/vovanbo/css2modernizr
440
+ [`mq4-hover-shim`]: https://github.com/twbs/mq4-hover-shim
406
441
  [`postcss-focus`]: https://github.com/postcss/postcss-focus
442
+ [`css2modernizr`]: https://github.com/vovanbo/css2modernizr
443
+ [`postcss-short`]: https://github.com/jonathantneal/postcss-short
444
+ [`postcss-alias`]: https://github.com/seaneking/postcss-alias
407
445
  [`postcss-at2x`]: https://github.com/simonsmith/postcss-at2x
408
- [`postcss-neat`]: https://github.com/jo-asakura/postcss-neat
409
- [`autoprefixer`]: https://github.com/postcss/autoprefixer
410
- [`css-mqpacker`]: https://github.com/hail2u/node-css-mqpacker
446
+ [`postcss-calc`]: https://github.com/postcss/postcss-calc
411
447
  [`postcss-each`]: https://github.com/outpunk/postcss-each
412
448
  [`postcss-epub`]: https://github.com/Rycochet/postcss-epub
413
- [`postcss-calc`]: https://github.com/postcss/postcss-calc
414
449
  [`postcss-grid`]: https://github.com/andyjansson/postcss-grid
415
- [`postcss-size`]: https://github.com/postcss/postcss-size
416
450
  [`postcss-host`]: https://github.com/vitkarpov/postcss-host
451
+ [`postcss-neat`]: https://github.com/jo-asakura/postcss-neat
452
+ [`postcss-size`]: https://github.com/postcss/postcss-size
417
453
  [`postcss-vmin`]: https://github.com/iamvdo/postcss-vmin
454
+ [`autoprefixer`]: https://github.com/postcss/autoprefixer
455
+ [`css-mqpacker`]: https://github.com/hail2u/node-css-mqpacker
418
456
  [`postcss-bem`]: https://github.com/ileri/postcss-bem
419
- [`postcss-url`]: https://github.com/postcss/postcss-url
420
- [`postcss-map`]: https://github.com/pascalduez/postcss-map
421
457
  [`postcss-for`]: https://github.com/antyakushev/postcss-for
458
+ [`postcss-map`]: https://github.com/pascalduez/postcss-map
459
+ [`postcss-url`]: https://github.com/postcss/postcss-url
422
460
  [`css-byebye`]: https://github.com/AoDev/css-byebye
461
+ [`stylehacks`]: https://github.com/ben-eb/stylehacks
423
462
  [`cssgrace`]: https://github.com/cssdream/cssgrace
424
463
  [`csstyle`]: https://github.com/geddski/csstyle
425
464
  [`webpcss`]: https://github.com/lexich/webpcss
426
- [`rtlcss`]: https://github.com/MohammadYounes/rtlcss
427
- [`pixrem`]: https://github.com/robwierzbowski/node-pixrem
428
465
  [`doiuse`]: https://github.com/anandthakker/doiuse
466
+ [`pixrem`]: https://github.com/robwierzbowski/node-pixrem
467
+ [`rtlcss`]: https://github.com/MohammadYounes/rtlcss
429
468
  [`lost`]: https://github.com/corysimmons/lost
430
469
 
431
470
  ## How to Develop PostCSS Plugin
package/lib/container.js CHANGED
@@ -360,7 +360,7 @@ var Container = (function (_Node) {
360
360
  nodes = [nodes];
361
361
  } else if (nodes.prop) {
362
362
  if (typeof nodes.value === 'undefined') {
363
- throw 'value field is missed in node creation';
363
+ throw new Error('Value field is missed in node creation');
364
364
  }
365
365
  nodes = [new _declaration2['default'](nodes)];
366
366
  } else if (nodes.selector) {
@@ -372,7 +372,7 @@ var Container = (function (_Node) {
372
372
  } else if (nodes.text) {
373
373
  nodes = [new _comment2['default'](nodes)];
374
374
  } else {
375
- throw 'Unknown node type in node creation';
375
+ throw new Error('Unknown node type in node creation');
376
376
  }
377
377
  }
378
378
 
@@ -96,26 +96,30 @@ var LazyResult = (function () {
96
96
  } catch (err) {}
97
97
  };
98
98
 
99
- LazyResult.prototype.asyncTick = function asyncTick(plugins, resolve, reject) {
99
+ LazyResult.prototype.asyncTick = function asyncTick(resolve, reject) {
100
100
  var _this = this;
101
101
 
102
- if (plugins.length === 0) return resolve();
102
+ if (this.plugin >= this.processor.plugins.length) {
103
+ this.processed = true;
104
+ return resolve();
105
+ }
103
106
 
104
107
  try {
105
108
  (function () {
106
- var plugin = plugins.shift();
109
+ var plugin = _this.processor.plugins[_this.plugin];
107
110
  var promise = _this.run(plugin);
111
+ _this.plugin += 1;
108
112
 
109
113
  if (isPromise(promise)) {
110
114
  promise.then(function () {
111
- _this.asyncTick(plugins, resolve, reject);
115
+ _this.asyncTick(resolve, reject);
112
116
  })['catch'](function (error) {
113
117
  _this.handleError(error, plugin);
114
118
  _this.processed = true;
115
119
  reject(error);
116
120
  });
117
121
  } else {
118
- _this.asyncTick(plugins, resolve, reject);
122
+ _this.asyncTick(resolve, reject);
119
123
  }
120
124
  })();
121
125
  } catch (error) {
@@ -140,10 +144,10 @@ var LazyResult = (function () {
140
144
  return this.processing;
141
145
  }
142
146
 
143
- var plugins = this.processor.plugins.slice(0);
144
147
  this.processing = new Promise(function (resolve, reject) {
145
148
  if (_this2.error) return reject(_this2.error);
146
- _this2.asyncTick(plugins, resolve, reject);
149
+ _this2.plugin = 0;
150
+ _this2.asyncTick(resolve, reject);
147
151
  }).then(function () {
148
152
  _this2.processed = true;
149
153
  return _this2.stringify();
@@ -157,7 +161,7 @@ var LazyResult = (function () {
157
161
  this.processed = true;
158
162
 
159
163
  if (this.processing) {
160
- throw 'Use process(css).then(cb) to work with async plugins';
164
+ throw new Error('Use process(css).then(cb) to work with async plugins');
161
165
  }
162
166
 
163
167
  if (this.error) throw this.error;
@@ -178,7 +182,7 @@ var LazyResult = (function () {
178
182
 
179
183
  var promise = this.run(plugin);
180
184
  if (isPromise(promise)) {
181
- throw 'Use process(css).then(cb) to work with async plugins';
185
+ throw new Error('Use process(css).then(cb) to work with async plugins');
182
186
  }
183
187
  }
184
188
 
@@ -54,13 +54,16 @@ var PreviousMap = (function () {
54
54
  };
55
55
 
56
56
  PreviousMap.prototype.decodeInline = function decodeInline(text) {
57
+ var utf64 = 'data:application/json;charset=utf-8;base64,';
58
+ var b64 = 'data:application/json;base64,';
57
59
  var uri = 'data:application/json,';
58
- var base64 = 'data:application/json;base64,';
59
60
 
60
61
  if (this.startWith(text, uri)) {
61
62
  return decodeURIComponent(text.substr(uri.length));
62
- } else if (this.startWith(text, base64)) {
63
- return _jsBase64.Base64.decode(text.substr(base64.length));
63
+ } else if (this.startWith(text, b64)) {
64
+ return _jsBase64.Base64.decode(text.substr(b64.length));
65
+ } else if (this.startWith(text, utf64)) {
66
+ return _jsBase64.Base64.decode(text.substr(utf64.length));
64
67
  } else {
65
68
  var encoding = text.match(/data:application\/json;([^,]+),/)[1];
66
69
  throw new Error('Unsupported source map encoding ' + encoding);
package/lib/processor.js CHANGED
@@ -48,8 +48,10 @@ var Processor = (function () {
48
48
 
49
49
  var type = typeof i;
50
50
  if ((type === 'object' || type === 'function') && i.postcss) {
51
- normalized.push(i.postcss);
52
- } else if (type === 'object' && Array.isArray(i.plugins)) {
51
+ i = i.postcss;
52
+ }
53
+
54
+ if (typeof i === 'object' && Array.isArray(i.plugins)) {
53
55
  normalized = normalized.concat(i.plugins);
54
56
  } else {
55
57
  normalized.push(i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "4.1.12",
3
+ "version": "4.1.16",
4
4
  "description": "Tool for transforming CSS with JS plugins",
5
5
  "keywords": [
6
6
  "css",
@@ -27,18 +27,18 @@
27
27
  "concat-with-sourcemaps": "1.0.2",
28
28
  "gulp-json-editor": "2.2.1",
29
29
  "load-resources": "0.1.0",
30
- "gulp-eslint": "0.14.0",
30
+ "gulp-eslint": "0.15.0",
31
31
  "gulp-babel": "5.1.0",
32
32
  "gulp-mocha": "2.1.2",
33
- "yaspeller": "2.4.0",
34
- "gulp-util": "3.0.5",
33
+ "yaspeller": "2.5.0",
34
+ "gulp-util": "3.0.6",
35
35
  "gulp-run": "1.6.8",
36
- "fs-extra": "0.20.0",
37
- "sinon": "1.15.3",
36
+ "fs-extra": "0.21.0",
37
+ "sinon": "1.15.4",
38
38
  "mocha": "2.2.5",
39
39
  "gulp": "3.9.0",
40
40
  "chai": "3.0.0",
41
- "babel": "5.6.2"
41
+ "babel": "5.6.14"
42
42
  },
43
43
  "scripts": {
44
44
  "test": "gulp"
package/gulpfile.babel.js DELETED
@@ -1,148 +0,0 @@
1
- import gulp from 'gulp';
2
- import path from 'path';
3
- import fs from 'fs-extra';
4
-
5
- gulp.task('clean', (done) => {
6
- fs.remove(path.join(__dirname, 'postcss.js'), () => {
7
- fs.remove(path.join(__dirname, 'build'), done);
8
- });
9
- });
10
-
11
- // Build
12
-
13
- gulp.task('build:lib', ['clean'], () => {
14
- let babel = require('gulp-babel');
15
- return gulp.src('lib/*.js')
16
- .pipe(babel({ loose: 'all' }))
17
- .pipe(gulp.dest('build/lib'));
18
- });
19
-
20
- gulp.task('build:docs', ['clean'], () => {
21
- let ignore = require('fs').readFileSync('.npmignore').toString()
22
- .trim().split(/\n+/)
23
- .concat(['.npmignore', 'index.js', 'package.json'])
24
- .map( i => '!' + i );
25
- return gulp.src(['*'].concat(ignore))
26
- .pipe(gulp.dest('build'));
27
- });
28
-
29
- gulp.task('build:package', ['clean'], () => {
30
- let editor = require('gulp-json-editor');
31
- gulp.src('./package.json')
32
- .pipe(editor( (p) => {
33
- p.main = 'lib/postcss';
34
- p.devDependencies.babel = p.dependencies.babel;
35
- delete p.dependencies.babel;
36
- return p;
37
- }))
38
- .pipe(gulp.dest('build'));
39
- });
40
-
41
- gulp.task('build', ['build:lib', 'build:docs', 'build:package']);
42
-
43
- // Lint
44
-
45
- gulp.task('lint', () => {
46
- let eslint = require('gulp-eslint');
47
- return gulp.src(['*.js', 'lib/*.js', 'test/*.js'])
48
- .pipe(eslint())
49
- .pipe(eslint.format())
50
- .pipe(eslint.failAfterError());
51
- });
52
-
53
- gulp.task('spellcheck', (done) => {
54
- let gutil = require('gulp-util');
55
- let run = require('gulp-run');
56
- run('yaspeller .').exec()
57
- .on('error', (err) => {
58
- done(new gutil.PluginError('spellcheck', {
59
- showStack: false,
60
- message: err.message
61
- }));
62
- })
63
- .on('finish', done);
64
- });
65
-
66
- // Tests
67
-
68
- gulp.task('integration', ['build:lib', 'build:package'], (done) => {
69
- let gutil = require('gulp-util');
70
- let load = require('load-resources');
71
-
72
- let postcss = require('./build/lib/postcss');
73
-
74
- let error = (url, message) => {
75
- gutil.log(gutil.colors.red('Fail on ' + url));
76
- done(new gutil.PluginError('integration', {
77
- showStack: false,
78
- message: message
79
- }));
80
- };
81
-
82
- let sites = {
83
- GitHub: 'https://github.com/',
84
- Twitter: 'https://twitter.com/',
85
- Bootstrap: 'github:twbs/bootstrap:dist/css/bootstrap.css',
86
- Habrahabr: 'http://habrahabr.ru/',
87
- Browserhacks: 'http://browserhacks.com/'
88
- };
89
- let urls = Object.keys(sites).map( i => sites[i] );
90
-
91
- let lastDomain = false;
92
- let siteIndex = -1;
93
-
94
- load(urls, '.css', (css, url, last) => {
95
- postcss().process(css, {
96
- map: { annotation: false },
97
- safe: url.match('browserhacks.com')
98
-
99
- }).catch( (e) => {
100
- fs.writeFileSync('fail.css', css);
101
- return error(url, 'Parsing error: ' + e.message + e.stack);
102
-
103
- }).then( (result) => {
104
- if ( !result ) return;
105
-
106
- if ( result.css !== css ) {
107
- fs.writeFileSync('origin.css', css);
108
- fs.writeFileSync('fail.css', result.css);
109
- error(url, 'Output is not equal input');
110
- return;
111
- }
112
-
113
- let domain = url.match(/https?:\/\/[^\/]+/)[0];
114
- if ( domain !== lastDomain ) {
115
- lastDomain = domain;
116
- siteIndex += 1;
117
- gutil.log('Test ' + Object.keys(sites)[siteIndex] + ' styles');
118
- }
119
- gutil.log(' ' + gutil.colors.green(path.basename(url)));
120
-
121
- if ( last ) done();
122
- }).catch(done);
123
- });
124
- });
125
-
126
- gulp.task('test', () => {
127
- let mocha = require('gulp-mocha');
128
- return gulp.src('test/*.js', { read: false }).pipe(mocha());
129
- });
130
-
131
- // Helpers
132
-
133
- gulp.task('cases', () => {
134
- let postcss = require('./lib/postcss');
135
- let cases = path.join(__dirname, 'test', 'cases');
136
- fs.readdirSync(cases).forEach( (name) => {
137
- if ( !name.match(/\.css$/) ) return;
138
- let css = fs.readFileSync(path.join(cases, name));
139
- let root = postcss.parse(css, { from: '/' + name });
140
- let json = JSON.stringify(root, null, 4);
141
- let file = path.join(cases, name.replace(/\.css$/, '.json'));
142
- fs.writeFileSync(file, json + '\n');
143
- });
144
- });
145
-
146
- // Common
147
-
148
- gulp.task('default', ['lint', 'spellcheck', 'test', 'integration']);