postcss
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -0,1 +1,4 @@ | ||
## 3.0.3 | ||
* Increase tokenizer speed (by Roman Dvornov). | ||
## 3.0.2 | ||
@@ -2,0 +5,0 @@ * Fix empty comment parsing. |
@@ -33,2 +33,5 @@ "use strict"; | ||
writable: true, | ||
// Stringify at-rule | ||
value: function (builder, semicolon) { | ||
@@ -56,2 +59,5 @@ var name = "@" + this.name; | ||
writable: true, | ||
// Hack to mark, that at-rule contains childs | ||
value: function (child) { | ||
@@ -64,2 +70,5 @@ if (!this.childs) this.childs = []; | ||
writable: true, | ||
// Hack to mark, that at-rule contains childs | ||
value: function (child) { | ||
@@ -72,2 +81,5 @@ if (!this.childs) this.childs = []; | ||
writable: true, | ||
// Hack to mark, that at-rule contains childs | ||
value: function (exist, add) { | ||
@@ -80,2 +92,5 @@ if (!this.childs) this.childs = []; | ||
writable: true, | ||
// Hack to mark, that at-rule contains childs | ||
value: function (exist, add) { | ||
@@ -82,0 +97,0 @@ if (!this.childs) this.childs = []; |
@@ -42,2 +42,5 @@ "use strict"; | ||
writable: true, | ||
// Stringify declaration | ||
value: function (builder) { | ||
@@ -44,0 +47,0 @@ if (this.before) builder(this.before); |
@@ -48,2 +48,5 @@ "use strict"; | ||
writable: true, | ||
// Stringify container childs | ||
value: function (builder) { | ||
@@ -65,2 +68,6 @@ if (!this.childs) return; | ||
writable: true, | ||
// Stringify node with start (for example, selector) and brackets block | ||
// with child inside | ||
value: function (builder, start) { | ||
@@ -85,2 +92,6 @@ var before = this.style("beforeRule"); | ||
writable: true, | ||
// Add child to end of list without any checks. | ||
// Please, use `append()` method, `push()` is mostly for parser. | ||
value: function (child) { | ||
@@ -94,2 +105,18 @@ child.parent = this; | ||
writable: true, | ||
// Execute `callback` on every child element. First arguments will be child | ||
// node, second will be index. | ||
// | ||
// css.each( (rule, i) => { | ||
// console.log(rule.type + ' at ' + i); | ||
// }); | ||
// | ||
// It is safe for add and remove elements to list while iterating: | ||
// | ||
// css.each( (rule) => { | ||
// css.insertBefore( rule, addPrefix(rule) ); | ||
// # On next iteration will be next rule, regardless of that | ||
// # list size was increased | ||
// }); | ||
value: function (callback) { | ||
@@ -121,2 +148,13 @@ if (!this.lastEach) this.lastEach = 0; | ||
writable: true, | ||
// Execute callback on every child in all rules inside. | ||
// | ||
// First argument will be child node, second will be index inside parent. | ||
// | ||
// css.eachInside( (node, i) => { | ||
// console.log(node.type + ' at ' + i); | ||
// }); | ||
// | ||
// Also as `each` it is safe of insert/remove nodes inside iterating. | ||
value: function (callback) { | ||
@@ -136,2 +174,15 @@ return this.each(function (child, i) { | ||
writable: true, | ||
// Execute callback on every declaration in all rules inside. | ||
// It will goes inside at-rules recursivelly. | ||
// | ||
// First argument will be declaration node, second will be index inside | ||
// parent rule. | ||
// | ||
// css.eachDecl( (decl, i) => { | ||
// console.log(decl.prop + ' in ' + decl.parent.selector + ':' + i); | ||
// }); | ||
// | ||
// Also as `each` it is safe of insert/remove nodes inside iterating. | ||
value: function (callback) { | ||
@@ -148,2 +199,15 @@ return this.eachInside(function (child, i) { | ||
writable: true, | ||
// Execute `callback` on every rule in conatiner and inside child at-rules. | ||
// | ||
// First argument will be rule node, second will be index inside parent. | ||
// | ||
// css.eachRule( (rule, i) => { | ||
// if ( parent.type == 'atrule' ) { | ||
// console.log(rule.selector + ' in ' + rule.parent.name); | ||
// } else { | ||
// console.log(rule.selector + ' at ' + i); | ||
// } | ||
// }); | ||
value: function (callback) { | ||
@@ -160,2 +224,15 @@ return this.eachInside(function (child, i) { | ||
writable: true, | ||
// Execute `callback` on every at-rule in conatiner and inside at-rules. | ||
// | ||
// First argument will be at-rule node, second will be index inside parent. | ||
// | ||
// css.eachAtRule( (atrule, parent, i) => { | ||
// if ( parent.type == 'atrule' ) { | ||
// console.log(atrule.name + ' in ' + atrule.parent.name); | ||
// } else { | ||
// console.log(atrule.name + ' at ' + i); | ||
// } | ||
// }); | ||
value: function (callback) { | ||
@@ -172,2 +249,15 @@ return this.eachInside(function (child, i) { | ||
writable: true, | ||
// Execute callback on every block comment (only between rules | ||
// and declarations, not inside selectors and values) in all rules inside. | ||
// | ||
// First argument will be comment node, second will be index inside | ||
// parent rule. | ||
// | ||
// css.eachComment( (comment, i) => { | ||
// console.log(comment.content + ' at ' + i); | ||
// }); | ||
// | ||
// Also as `each` it is safe of insert/remove nodes inside iterating. | ||
value: function (callback) { | ||
@@ -184,2 +274,11 @@ return this.eachInside(function (child, i) { | ||
writable: true, | ||
// Add child to container. | ||
// | ||
// css.append(rule); | ||
// | ||
// You can add declaration by hash: | ||
// | ||
// rule.append({ prop: 'color', value: 'black' }); | ||
value: function (child) { | ||
@@ -195,2 +294,11 @@ var childs = this.normalize(child, this.last); | ||
writable: true, | ||
// Add child to beginning of container | ||
// | ||
// css.prepend(rule); | ||
// | ||
// You can add declaration by hash: | ||
// | ||
// rule.prepend({ prop: 'color', value: 'black' }); | ||
value: function (child) { | ||
@@ -211,2 +319,12 @@ var childs = this.normalize(child, this.first, "prepend").reverse(); | ||
writable: true, | ||
// Insert new `added` child before `exist`. | ||
// You can set node object or node index (it will be faster) in `exist`. | ||
// | ||
// css.insertAfter(1, rule); | ||
// | ||
// You can add declaration by hash: | ||
// | ||
// rule.insertBefore(1, { prop: 'color', value: 'black' }); | ||
value: function (exist, add) { | ||
@@ -234,2 +352,12 @@ exist = this.index(exist); | ||
writable: true, | ||
// Insert new `added` child after `exist`. | ||
// You can set node object or node index (it will be faster) in `exist`. | ||
// | ||
// css.insertAfter(1, rule); | ||
// | ||
// You can add declaration by hash: | ||
// | ||
// rule.insertAfter(1, { prop: 'color', value: 'black' }); | ||
value: function (exist, add) { | ||
@@ -256,2 +384,7 @@ exist = this.index(exist); | ||
writable: true, | ||
// Remove `child` by index or node. | ||
// | ||
// css.remove(2); | ||
value: function (child) { | ||
@@ -274,2 +407,6 @@ child = this.index(child); | ||
writable: true, | ||
// Return true if all childs return true in `condition`. | ||
// Just shorcut for `childs.every`. | ||
value: function (condition) { | ||
@@ -281,2 +418,6 @@ return this.childs.every(condition); | ||
writable: true, | ||
// Return true if one or more childs return true in `condition`. | ||
// Just shorcut for `childs.some`. | ||
value: function (condition) { | ||
@@ -288,2 +429,5 @@ return this.childs.some(condition); | ||
writable: true, | ||
// Return index of child | ||
value: function (child) { | ||
@@ -298,2 +442,3 @@ if (typeof (child) == "number") { | ||
first: { | ||
// Shortcut to get first child | ||
get: function () { | ||
@@ -305,2 +450,3 @@ if (!this.childs) return undefined; | ||
last: { | ||
// Shortcut to get first child | ||
get: function () { | ||
@@ -313,2 +459,5 @@ if (!this.childs) return undefined; | ||
writable: true, | ||
// Normalize child before insert. Copy before from `sample`. | ||
value: function (child, sample) { | ||
@@ -315,0 +464,0 @@ if (!child.type && !Array.isArray(child)) { |
@@ -57,2 +57,5 @@ "use strict"; | ||
writable: true, | ||
// Return source of broken lines | ||
value: function (color) { | ||
@@ -59,0 +62,0 @@ var num = this.line - 1; |
@@ -43,2 +43,5 @@ "use strict"; | ||
writable: true, | ||
// Stringify declaration | ||
value: function (builder, semicolon) { | ||
@@ -61,2 +64,6 @@ var before = this.style("beforeDecl"); | ||
writable: true, | ||
// Clean `before` and `between` property in clone to copy it from new | ||
// parent rule | ||
value: function (overrides) { | ||
@@ -63,0 +70,0 @@ if (overrides === undefined) overrides = {}; |
@@ -53,2 +53,5 @@ "use strict"; | ||
writable: true, | ||
// Throw syntax error from this input | ||
value: function (message, line, column) { | ||
@@ -60,2 +63,5 @@ throw new CssSyntaxError(this, message, line, column); | ||
writable: true, | ||
// Get origin position of code if source map was given | ||
value: function (line, column) { | ||
@@ -82,2 +88,5 @@ if (!this.map) return false; | ||
writable: true, | ||
// Return path relative from source map root | ||
value: function (file) { | ||
@@ -84,0 +93,0 @@ return path.resolve(this.map.consumer().sourceRoot || ".", file); |
@@ -24,2 +24,5 @@ "use strict"; | ||
writable: true, | ||
// Should map be generated | ||
value: function () { | ||
@@ -35,2 +38,5 @@ if (typeof (this.opts.map) != "undefined") { | ||
writable: true, | ||
// Return source map arrays from previous compilation step (like Sass) | ||
value: function () { | ||
@@ -54,2 +60,5 @@ var _this = this; | ||
writable: true, | ||
// Should we inline source map to annotation comment | ||
value: function () { | ||
@@ -76,2 +85,5 @@ if (typeof (this.mapOpts.inline) != "undefined") { | ||
writable: true, | ||
// Should we set sourcesContent | ||
value: function () { | ||
@@ -92,2 +104,5 @@ if (typeof (this.mapOpts.sourcesContent) != "undefined") { | ||
writable: true, | ||
// Clear source map annotation comment | ||
value: function () { | ||
@@ -109,2 +124,5 @@ if (this.mapOpts.annotation === false) return; | ||
writable: true, | ||
// Set origin CSS content | ||
value: function () { | ||
@@ -127,2 +145,5 @@ var _this2 = this; | ||
writable: true, | ||
// Apply source map from previous compilation step (like Sass) | ||
value: function () { | ||
@@ -152,2 +173,5 @@ var prev, previous = this.previous(); | ||
writable: true, | ||
// Should we add annotation comment | ||
value: function () { | ||
@@ -169,2 +193,5 @@ if (this.isInline()) { | ||
writable: true, | ||
// Add source map annotation comment if it is needed | ||
value: function () { | ||
@@ -186,2 +213,5 @@ var content; | ||
writable: true, | ||
// Return output CSS file path | ||
value: function () { | ||
@@ -199,2 +229,5 @@ if (this.opts.to) { | ||
writable: true, | ||
// Return Result object with map | ||
value: function () { | ||
@@ -215,2 +248,5 @@ this.stringify(); | ||
writable: true, | ||
// Return path relative from output CSS file | ||
value: function (file) { | ||
@@ -233,2 +269,5 @@ var from = this.opts.to ? path.dirname(this.opts.to) : "."; | ||
writable: true, | ||
// Return path of node source for map | ||
value: function (node) { | ||
@@ -240,2 +279,5 @@ return this.relative(node.source.file || node.source.id); | ||
writable: true, | ||
// Return CSS string and source map | ||
value: function () { | ||
@@ -296,2 +338,5 @@ var _this3 = this; | ||
writable: true, | ||
// Return Result object with or without map | ||
value: function () { | ||
@@ -298,0 +343,0 @@ this.clearAnnotation(); |
@@ -44,2 +44,11 @@ "use strict"; | ||
writable: true, | ||
// Remove this node from parent | ||
// | ||
// decl.removeSelf(); | ||
// | ||
// Note, that removing by index is faster: | ||
// | ||
// rule.each( (decl, i) => rule.remove(i) ); | ||
value: function () { | ||
@@ -54,2 +63,7 @@ if (this.parent) { | ||
writable: true, | ||
// Shortcut to insert nodes before and remove self. | ||
// | ||
// importNode.replace( loadedRoot ); | ||
value: function (nodes) { | ||
@@ -63,2 +77,7 @@ this.parent.insertBefore(this, nodes); | ||
writable: true, | ||
// Return CSS string of current node | ||
// | ||
// decl.toString(); //=> " color: black" | ||
value: function () { | ||
@@ -75,2 +94,11 @@ var result = ""; | ||
writable: true, | ||
// Clone current node | ||
// | ||
// rule.append( decl.clone() ); | ||
// | ||
// You can override properties while cloning: | ||
// | ||
// rule.append( decl.clone({ value: '0' }) ); | ||
value: function (overrides) { | ||
@@ -87,2 +115,5 @@ if (overrides === undefined) overrides = {}; | ||
writable: true, | ||
// Remove `parent` node on cloning to fix circular structures | ||
value: function () { | ||
@@ -118,2 +149,5 @@ var fixed = {}; | ||
writable: true, | ||
// Copy code style from first node with same type | ||
value: function (name) { | ||
@@ -158,2 +192,5 @@ // Already had | ||
writable: true, | ||
// Use raw value if origin was not changed | ||
value: function (prop) { | ||
@@ -160,0 +197,0 @@ var value = this[prop]; |
@@ -363,2 +363,6 @@ "use strict"; | ||
writable: true, | ||
// Helpers | ||
value: function (node, line, column) { | ||
@@ -365,0 +369,0 @@ this.current.push(node); |
@@ -28,2 +28,5 @@ "use strict"; | ||
writable: true, | ||
// Add another function to CSS processors | ||
value: function (processor) { | ||
@@ -41,2 +44,5 @@ processor = this.normalize(processor); | ||
writable: true, | ||
// Process CSS throw installed processors | ||
value: function (css, opts) { | ||
@@ -71,2 +77,5 @@ if (opts === undefined) opts = {}; | ||
writable: true, | ||
// Return processor function | ||
value: function (processor) { | ||
@@ -73,0 +82,0 @@ var type = typeof (processor); |
@@ -25,2 +25,5 @@ "use strict"; | ||
writable: true, | ||
// Return SourceMapConsumer object to read map | ||
value: function () { | ||
@@ -35,2 +38,5 @@ if (!this.consumerCache) { | ||
writable: true, | ||
// Is map has sources content | ||
value: function () { | ||
@@ -42,2 +48,5 @@ return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0); | ||
writable: true, | ||
// Is `string` is starting with `start` | ||
value: function (string, start) { | ||
@@ -50,2 +59,5 @@ if (!string) return false; | ||
writable: true, | ||
// Load for annotation comment from previous compilation step | ||
value: function (css) { | ||
@@ -58,2 +70,5 @@ var match = css.match(/\/\*\s*# sourceMappingURL=(.*)\s*\*\//); | ||
writable: true, | ||
// Encode different type of inline | ||
value: function (text) { | ||
@@ -75,2 +90,5 @@ var uri = "data:application/json,"; | ||
writable: true, | ||
// Load previous map | ||
value: function (file, prev) { | ||
@@ -77,0 +95,0 @@ if (prev === false) return; |
@@ -19,2 +19,3 @@ "use strict"; | ||
map: { | ||
// Lazy method to return source map | ||
get: function () { | ||
@@ -26,2 +27,3 @@ if (!this.cssCached) this.stringify(); | ||
css: { | ||
// Lazy method to return CSS string | ||
get: function () { | ||
@@ -34,2 +36,5 @@ if (!this.cssCached) this.stringify(); | ||
writable: true, | ||
// Return CSS string on any try to print | ||
value: function () { | ||
@@ -41,2 +46,5 @@ return this.css; | ||
writable: true, | ||
// Generate CSS and map | ||
value: function () { | ||
@@ -43,0 +51,0 @@ var map = new MapGenerator(this.root, this.opts); |
@@ -39,2 +39,5 @@ "use strict"; | ||
writable: true, | ||
// Fix space when we remove first child | ||
value: function (child) { | ||
@@ -52,2 +55,5 @@ child = this.index(child); | ||
writable: true, | ||
// Fix spaces on insert before first rule | ||
value: function (child, sample, type) { | ||
@@ -77,2 +83,5 @@ var childs = Container.prototype.normalize.call(this, child, sample, type); | ||
writable: true, | ||
// Stringify styles | ||
value: function (builder) { | ||
@@ -85,2 +94,5 @@ this.stringifyContent(builder); | ||
writable: true, | ||
// Generate processing result with optional source map | ||
value: function (opts) { | ||
@@ -87,0 +99,0 @@ if (opts === undefined) opts = {}; |
@@ -35,2 +35,4 @@ "use strict"; | ||
selectors: { | ||
// Shortcut to get selectors as array | ||
get: function () { | ||
@@ -45,2 +47,5 @@ return list.comma(this.selector); | ||
writable: true, | ||
// Stringify rule | ||
value: function (builder) { | ||
@@ -47,0 +52,0 @@ this.stringifyBlock(builder, this.stringifyRaw("selector")); |
@@ -11,2 +11,3 @@ "use strict"; | ||
var length = css.length; | ||
var offset = -1; | ||
@@ -25,3 +26,5 @@ var line = 1; | ||
while (!isNaN(code = css.charCodeAt(pos))) { | ||
while (pos < length) { | ||
code = css.charCodeAt(pos); | ||
if (code == newline) { | ||
@@ -28,0 +31,0 @@ offset = pos; |
{ | ||
"name": "postcss", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Framework for CSS postprocessors with full source map support", | ||
@@ -27,11 +27,11 @@ "keywords": [ | ||
"gulp-jshint": "1.9.0", | ||
"gonzales-pe": "3.0.0-10", | ||
"gonzales-pe": "3.0.0-11", | ||
"gulp-bench": "1.1.0", | ||
"gulp-mocha": "1.1.1", | ||
"gulp-mocha": "2.0.0", | ||
"gulp-util": "3.0.1", | ||
"gulp-6to5": "1.0.1", | ||
"gulp-6to5": "1.0.2", | ||
"execSync": "1.0.2", | ||
"fs-extra": "0.12.0", | ||
"gonzales": "1.0.7", | ||
"stylecow": "3.0.2", | ||
"stylecow": "3.1.0", | ||
"through2": "0.6.3", | ||
@@ -45,3 +45,3 @@ "request": "2.48.0", | ||
"gulp": "3.8.10", | ||
"6to5": "1.12.12" | ||
"6to5": "1.12.26" | ||
}, | ||
@@ -48,0 +48,0 @@ "scripts": { |
@@ -51,2 +51,4 @@ # PostCSS [![Build Status](https://travis-ci.org/postcss/postcss.png)](https://travis-ci.org/postcss/postcss) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/postcss/postcss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
* [postcss-epub] to prefix ePub3 properties. | ||
* [doiuse] to lint your CSS on unsupported properties by Can I Use. | ||
* [postcss-assets] to inline files and insert image width and height. | ||
@@ -67,2 +69,4 @@ [Autoprefixer]: https://github.com/postcss/autoprefixer | ||
[postcss-epub]: https://github.com/Rycochet/postcss-epub | ||
[doiuse]: https://github.com/anandthakker/doiuse | ||
[postcss-assets]: https://github.com/borodean/postcss-assets | ||
@@ -69,0 +73,0 @@ ### Plugins |
108106
2272
1010