Comparing version 1.5.0 to 1.5.1
@@ -0,1 +1,7 @@ | ||
## 1.5.1 (January 14, 2016) | ||
- ensure `-` is not used as an identifier in attribute selectors (thanks to @mathiasbynens) | ||
- fix broken `justDoIt()` function | ||
- various small fixes | ||
## 1.5.0 (January 14, 2016) | ||
@@ -21,3 +27,2 @@ | ||
- prevent partial merge of rulesets at `@keyframes` (#80, #197) | ||
- fix issue with wrong space removals (#258) | ||
@@ -24,0 +29,0 @@ ### API |
@@ -41,3 +41,3 @@ var fs = require('fs'); | ||
.option('--restructure-off', 'Turns structure minimization off') | ||
.option('--stat', 'Output statistics instead of result') | ||
.option('--stat', 'Output statistics in stderr') | ||
.option('--debug [level]', 'Output intermediate state of CSS during compression', debugLevel, 0) | ||
@@ -44,0 +44,0 @@ .action(function(args) { |
@@ -1,7 +0,1 @@ | ||
function each(array, buffer) { | ||
for (var i = 0; i < array.length; i++) { | ||
toGonzales(array[i], buffer, array, i); | ||
} | ||
} | ||
function eachDelim(node, type, itemsProperty, delimeter) { | ||
@@ -38,3 +32,2 @@ var result = [node.info, type]; | ||
].concat(node.rules.map(toGonzales).filter(Boolean)); | ||
break; | ||
@@ -41,0 +34,0 @@ case 'Atrule': |
@@ -8,3 +8,3 @@ // Can unquote attribute detection | ||
function canUnquote(value) { | ||
if (!value) { | ||
if (value === '' || value === '-') { | ||
return; | ||
@@ -11,0 +11,0 @@ } |
@@ -14,4 +14,6 @@ var parse = require('./parser'); | ||
var compressed = compress(ast, { | ||
restructuring: !noStructureOptimizations | ||
restructuring: !noStructureOptimizations, | ||
outputAst: 'internal' | ||
}); | ||
return traslateInternal(compressed); | ||
@@ -34,3 +36,3 @@ }; | ||
if (minifyOptions.debug) { | ||
console.error('## parse', Date.now() - t); | ||
console.error('## parsing done in %d ms\n', Date.now() - t); | ||
} | ||
@@ -41,3 +43,3 @@ | ||
if (minifyOptions.debug) { | ||
console.error('## compress', Date.now() - t); | ||
console.error('## compressing done in %d ms\n', Date.now() - t); | ||
} | ||
@@ -44,0 +46,0 @@ |
{ | ||
"name": "csso", | ||
"description": "CSSO — CSS optimizer", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"homepage": "https://github.com/css/csso", | ||
@@ -6,0 +6,0 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (https://github.com/afelix)", |
@@ -23,3 +23,3 @@ [![NPM version](https://img.shields.io/npm/v/csso.svg)](https://www.npmjs.com/package/csso) | ||
--debug Output intermediate state of CSS during compression | ||
--debug [level] Output intermediate state of CSS during compression | ||
-h, --help Output usage information | ||
@@ -29,3 +29,4 @@ -i, --input <filename> Input file | ||
--restructure-off Turns structure minimization off | ||
-v, --version Output the version | ||
--stat Output statistics in stderr | ||
-v, --version Output version | ||
``` | ||
@@ -47,2 +48,67 @@ | ||
Debug and statistics: | ||
``` | ||
> echo '.test { color: #ff0000 }' | node bin/csso --stat >/dev/null | ||
File: <stdin> | ||
Original: 25 bytes | ||
Compressed: 16 bytes (64.00%) | ||
Saving: 9 bytes (36.00%) | ||
Time: 12 ms | ||
Memory: 0.346 MB | ||
``` | ||
``` | ||
> echo '.test { color: green; color: #ff0000 } .foo { color: red }' | node bin/csso --debug | ||
## parsing done in 10 ms | ||
Compress block #1 | ||
(0.002ms) convertToInternal | ||
(0.000ms) clean | ||
(0.001ms) compress | ||
(0.002ms) prepare | ||
(0.000ms) initialRejoinRuleset | ||
(0.000ms) rejoinAtrule | ||
(0.000ms) disjoin | ||
(0.000ms) buildMaps | ||
(0.000ms) markShorthands | ||
(0.000ms) processShorthand | ||
(0.001ms) restructBlock | ||
(0.000ms) rejoinRuleset | ||
(0.000ms) restructRuleset | ||
## compressing done in 9 ms | ||
.foo,.test{color:red} | ||
``` | ||
``` | ||
> echo '.test { color: green; color: #ff0000 } .foo { color: red }' | node bin/csso --debug 2 | ||
## parsing done in 8 ms | ||
Compress block #1 | ||
(0.002ms) convertToInternal | ||
.test{color:green;color:#ff0000}.foo{color:red} | ||
(0.000ms) clean | ||
.test{color:green;color:#ff0000}.foo{color:red} | ||
(0.001ms) compress | ||
.test{color:green;color:red}.foo{color:red} | ||
... | ||
(0.002ms) restructBlock | ||
.test{color:red}.foo{color:red} | ||
(0.001ms) rejoinRuleset | ||
.foo,.test{color:red} | ||
(0.000ms) restructRuleset | ||
.foo,.test{color:red} | ||
## compressing done in 13 ms | ||
.foo,.test{color:red} | ||
``` | ||
### API | ||
@@ -57,2 +123,9 @@ | ||
// there are some options you can pass | ||
var compressedWithOptions = csso.minify('.test { color: #ff0000; }', { | ||
restructuring: false, // don't change css structure, i.e. don't merge declarations, rulesets etc | ||
debug: true // show additional debug information: | ||
// true or number from 1 to 3 (greater number - more details) | ||
}); | ||
// you may do it step by step | ||
@@ -64,8 +137,2 @@ var ast = csso.parse('.test { color: #ff0000; }'); | ||
// .test{color:red} | ||
// There are two options you can pass | ||
var compressedWithOptions = csso.minify('.test { color: #ff0000; }', { | ||
restructuring: false, // don't combine same selectors | ||
debug: true // show additional debug information | ||
}) | ||
``` | ||
@@ -72,0 +139,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
188837
143
0
5418