Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clean-css

Package Overview
Dependencies
Maintainers
1
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-css - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

LICENSE

6

History.md

@@ -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 @@ ==================

23

lib/clean.js

@@ -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}',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc