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.3.2 to 0.3.3

test/bench.js

17

History.md

@@ -0,4 +1,9 @@

0.3.3 / 2012-05-27
==================
* Fixed tests, package.json for development, and regex for removing empty declarations (thanks to @vvo).
0.3.2 / 2012-01-17
==================
* Fixed output method under node 0.6 which incorrectly tried to close process.stdout.

@@ -8,8 +13,8 @@

==================
* Fixed cleaning up '0 0 0 0' expressions.
* Fixed cleaning up '0 0 0 0' expressions.
0.3.0 / 2011-11-29
==================
* Clean-css requires node 0.4.0+ to run.

@@ -51,3 +56,3 @@ * Removed node's 0.2.x 'sys' package dependency (thanks to @jmalonzo for a patch).

0.2.0 / 2011-03-02
0.2.0 / 2011-03-02
==================

@@ -57,3 +62,3 @@

* Changed code inclusion (thus version bump).
0.1.0 / 2011-02-27

@@ -60,0 +65,0 @@ ==================

@@ -10,21 +10,21 @@ var util = require('util');

},
process: function(data) {
process: function(data, options) {
var specialComments = [],
contentBlocks = [];
options = options || {};
// replace function
var replace = function(pattern, replacement) {
if (true) {
if (options.debug) { // for debugging purposes only
console.time(pattern);
data = data.replace(pattern, replacement);
} else { // for debugging purposes only
var start = new Date().getTime();
console.timeEnd(pattern);
var end = new Date().getTime();
} else {
data = data.replace(pattern, replacement);
var end = new Date().getTime();
if (end > start)
util.print(pattern + ' -> ' + (end - start) + ' milliseconds\n');
}
};
// strip comments one by one

@@ -35,3 +35,3 @@ for (var end = 0; end < data.length; ) {

if (start == -1 || end == -1) break;
if (data[start + 2] == '!') {

@@ -46,3 +46,3 @@ // in case of special comments, replace them with a placeholder

}
// replace content: with a placeholder

@@ -52,3 +52,3 @@ for (var end = 0; end < data.length; ) {

if (start == -1) break;
var wrapper = /[^ :]/.exec(data.substring(start + 7))[0];

@@ -62,3 +62,3 @@ if (/['"]/.test(wrapper) == false) {

var lastIndex = data.indexOf(wrapper, firstIndex + 1);
contentBlocks.push(data.substring(firstIndex, lastIndex + 1));

@@ -68,3 +68,3 @@ data = data.substring(0, firstIndex) + '__CSSCONTENT__' + data.substring(lastIndex + 1);

}
replace(/;\s*;+/g, ';') // whitespace between semicolons & multiple semicolons

@@ -116,3 +116,3 @@ replace(/\n/g, '') // line breaks

replace(/([: ,=\-])0\.(\d)/g, '$1.$2')
replace(/[^\}]+{(;)*}/g, '') // empty elements
replace(/[^}]+?{\s*?}/g, '') // empty elements
if (data.indexOf('charset') > 0) replace(/(.+)(@charset [^;]+;)/, '$2$1') // move first charset to the beginning

@@ -123,3 +123,3 @@ replace(/(.)(@charset [^;]+;)/g, '$1') // remove all extra charsets that are not at the beginning

replace(/\} /g, '}') // whitespace after definition
// Get the special comments, content content, and spaces inside calc back

@@ -131,3 +131,3 @@ replace(/calc\([^\}]+\}/g, function(match) {

replace(/__CSSCONTENT__/g, function() { return contentBlocks.shift(); });
return data.trim() // trim spaces at beginning and end

@@ -134,0 +134,0 @@ }

@@ -11,3 +11,3 @@ {

},
"version": "0.3.2",
"version": "0.3.3",
"main": "index.js",

@@ -20,2 +20,5 @@ "bin": {

},
"devDependencies": {
"vows": "0.6.x"
},
"engines": {

@@ -22,0 +25,0 @@ "node": ">=0.4.0"

var vows = require('vows'),
path = require('path'),
fs = require('fs'),

@@ -8,11 +9,11 @@ assert = require('assert'),

var context = {};
fs.readdirSync('./test/data/').forEach(function(filename) {
fs.readdirSync(path.join(__dirname, 'data')).forEach(function(filename) {
if (/min.css$/.exec(filename)) return;
var testName = filename.split('.')[0];
context[testName] = {
topic: function() {
return {
plain: fs.readFileSync('./test/data/' + testName + '.css').toString('utf-8'),
minimized: fs.readFileSync('./test/data/' + testName + '-min.css').toString('utf-8').replace(/\n/g, '')
plain: fs.readFileSync(path.join(__dirname, 'data', testName + '.css')).toString('utf-8'),
minimized: fs.readFileSync(path.join(__dirname, 'data', testName + '-min.css')).toString('utf-8').replace(/\n/g, '')
};

@@ -31,2 +32,2 @@ }

.addBatch(batchContexts())
.export(module);
.export(module);
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