postcss
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,1 +1,5 @@ | ||
## 0.3.1 | ||
* Fix relative paths from previous source map. | ||
* Safer space split in `Rule#selectors` (by Simon Lydell). | ||
## 0.3 “Prince Seere” | ||
@@ -2,0 +6,0 @@ * Add `Comment` node for comments between declarations or rules. |
@@ -101,5 +101,18 @@ (function() { | ||
MapGenerator.prototype.applyPrevMap = function() { | ||
var prev; | ||
var from, prev, source; | ||
if (this.prevMap()) { | ||
prev = new mozilla.SourceMapConsumer(this.prevMap()); | ||
prev = this.prevMap(); | ||
prev = typeof prev === 'string' ? JSON.parse(prev) : prev instanceof mozilla.SourceMapConsumer ? mozilla.SourceMapGenerator.fromSourceMap(prev).toJSON() : typeof prev === 'object' && prev.toJSON ? prev.toJSON() : prev; | ||
from = path.dirname(this.opts.from); | ||
prev.sources = (function() { | ||
var _i, _len, _ref, _results; | ||
_ref = prev.sources; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
source = _ref[_i]; | ||
_results.push(this.relative(path.resolve(from, source))); | ||
} | ||
return _results; | ||
}).call(this); | ||
prev = new mozilla.SourceMapConsumer(prev); | ||
return this.map.applySourceMap(prev, this.relative(this.opts.from)); | ||
@@ -106,0 +119,0 @@ } |
(function() { | ||
var Container, Declaration, Rule, | ||
var Container, Declaration, Rule, list, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -10,2 +10,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
list = require('./list'); | ||
Rule = (function(_super) { | ||
@@ -41,3 +43,3 @@ __extends(Rule, _super); | ||
get: function() { | ||
return this.selector.split(/\s*,\s*/); | ||
return list.comma(this.selector); | ||
}, | ||
@@ -44,0 +46,0 @@ set: function(values) { |
{ | ||
"name": "postcss", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Framework for CSS postprocessors", | ||
@@ -13,3 +13,3 @@ "keywords": ["css", "parser", "postproccessor"], | ||
"dependencies": { | ||
"source-map": "~0.1.31", | ||
"source-map": "~0.1.32", | ||
"base64-js": "0.0.6" | ||
@@ -16,0 +16,0 @@ }, |
@@ -16,2 +16,3 @@ # PostCSS | ||
* CSS minifier or beautifizer. | ||
* CSS polyfills. | ||
* Grunt plugin to generate sprites, include `data-uri` images | ||
@@ -26,5 +27,10 @@ or any other works. | ||
* [Autoprefixer](https://github.com/ai/autoprefixer) | ||
* [grunt-pixrem](https://github.com/robwierzbowski/grunt-pixrem) | ||
* [Autoprefixer] adds vendor prefixes by Can I Use data. | ||
* [grunt-pixrem], `rem` unit polyfill. | ||
* [CSS MQPacker] joins same media queries. | ||
[Autoprefixer]: https://github.com/ai/autoprefixer | ||
[grunt-pixrem]: https://github.com/robwierzbowski/grunt-pixrem | ||
[CSS MQPacker]: https://github.com/hail2u/node-css-mqpacker | ||
## Quick Example | ||
@@ -331,2 +337,27 @@ | ||
### Helpers | ||
#### Vendor | ||
PostCSS contains heigh optimized code to split vendor prefix: | ||
```js | ||
var vendor = require('postcss/lib/vendor'); | ||
vendor.prefix('-moz-tab-size') //=> '-moz-' | ||
vendor.unprefixed('-moz-tab-size') //=> 'tab-size' | ||
``` | ||
#### List | ||
To safely split comma- or space-separated values (like in `background-image` | ||
or `transform` ) with brackets and quotes support you can use `list` helper: | ||
```js | ||
var list = require('postcss/lib/list'); | ||
list.space(image.value) //=> ['linear-gradient(white, black)', 'blue'] | ||
list.comma(transform.value) //=> ['color 200ms', 'background 200ms'] | ||
``` | ||
### Nodes | ||
@@ -333,0 +364,0 @@ |
71168
1582
733
Updatedsource-map@~0.1.32