clean-css
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -0,1 +1,7 @@ | ||
0.2.5 / 2011-11-27 | ||
================== | ||
* Fixed issue with cleaning up spaces inside calc/-moz-calc declarations (thanks to @cvan for reporting it). | ||
* Fixed converting #f00 to red in borders and gradients. | ||
0.2.4 / 2011-05-25 | ||
@@ -2,0 +8,0 @@ ================== |
@@ -17,11 +17,11 @@ var sys = require('sys'); | ||
var replace = function(pattern, replacement) { | ||
var start = new Date().getTime(); | ||
data = data.replace(pattern, replacement); | ||
var end = new Date().getTime(); | ||
if (true) { | ||
data = data.replace(pattern, replacement); | ||
} else { // for debugging purposes only | ||
var start = new Date().getTime(); | ||
data = data.replace(pattern, replacement); | ||
var end = new Date().getTime(); | ||
if (false && end > start) { | ||
sys.print(pattern); | ||
sys.print(' -> '); | ||
sys.print(end - start); | ||
sys.print(' milliseconds\n'); | ||
if (end > start) | ||
sys.print(pattern + ' -> ' + (end - start) + ' milliseconds\n'); | ||
} | ||
@@ -97,3 +97,3 @@ }; | ||
}) | ||
replace(/color:#f00/g, 'color:red') // replace #f00 with red as it's shorter | ||
replace(/([: ,\(])#f00/g, '$1red') // replace #f00 with red as it's shorter | ||
replace(/font\-weight:(\w+)/g, function(match, weight) { // replace font weight with numerical value | ||
@@ -119,3 +119,6 @@ if (weight == 'normal') return 'font-weight:400'; | ||
// Get the special comments && content back | ||
// Get the special comments, content content, and spaces inside calc back | ||
replace(/calc\((.+)\)([;\}\w])/, function(match) { | ||
return match.replace(/\+/g, ' + '); | ||
}); | ||
replace(/__CSSCOMMENT__/g, function() { return specialComments.shift(); }); | ||
@@ -122,0 +125,0 @@ replace(/__CSSCONTENT__/g, function() { return contentBlocks.shift(); }); |
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"main": "index.js", | ||
@@ -14,0 +14,0 @@ "bin": { |
@@ -42,1 +42,5 @@ ## What is clean-css? ## | ||
make test | ||
## License ## | ||
Clean-css is released under the MIT license. |
@@ -81,2 +81,18 @@ var vows = require('vows'), | ||
'a{color:#fff}' | ||
], | ||
'not inside calc method #1': [ | ||
'a{width:-moz-calc(100% - 1em);width:calc(100% - 1em)}', | ||
'a{width:-moz-calc(100% - 1em);width:calc(100% - 1em)}' | ||
], | ||
'not inside calc method #2': [ | ||
'div{margin:-moz-calc(50% + 15px) -moz-calc(50% + 15px);margin:calc(50% + .5rem) calc(50% + .5rem)}', | ||
'div{margin:-moz-calc(50% + 15px) -moz-calc(50% + 15px);margin:calc(50% + .5rem) calc(50% + .5rem)}' | ||
], | ||
'not inside calc method with more parentheses': [ | ||
'div{height:-moz-calc((10% + 12px)/2 + 10em)}', | ||
'div{height:-moz-calc((10% + 12px)/2 + 10em)}' | ||
], | ||
'not inside calc method with multiplication': [ | ||
'div{height:-moz-calc(3 * 2em + 10px)}', | ||
'div{height:-moz-calc(3 * 2em + 10px)}' | ||
] | ||
@@ -215,6 +231,18 @@ }), | ||
], | ||
'hex value to color name': [ | ||
'hex value to color name if shorter': [ | ||
'p{color:#f00}', | ||
'p{color:red}' | ||
], | ||
'hex value to color name in borders': [ | ||
'p{border:1px solid #f00}', | ||
'p{border:1px solid red}' | ||
], | ||
'hex value to color name in gradients': [ | ||
'p{background:-moz-linear-gradient(-90deg,#000,#f00)}', | ||
'p{background:-moz-linear-gradient(-90deg,#000,red)}' | ||
], | ||
'hex value to color name in gradients #2': [ | ||
'p{background:-webkit-gradient(linear, left top, left bottom, from(#000), to(#f00))}', | ||
'p{background:-webkit-gradient(linear,left top,left bottom,from(#000),to(red))}' | ||
], | ||
'border color': [ | ||
@@ -221,0 +249,0 @@ 'p{border:1px solid #f94311}', |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
64695
17
0
1674
45
0
1