clean-css
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -0,5 +1,11 @@ | ||
0.7.0 / 2012-10-14 | ||
================== | ||
* Added stripping special comments to CLI (--s0 and --s1 options). | ||
* Added stripping special comments to programatic interface (keepSpecialComments option). | ||
0.6.0 / 2012-08-05 | ||
================== | ||
* Full Windows support with tests (./test.bat) | ||
* Full Windows support with tests (./test.bat). | ||
@@ -6,0 +12,0 @@ 0.5.0 / 2012-08-02 |
@@ -25,2 +25,9 @@ var util = require('util'); | ||
// * - leave all important comments | ||
// 1 - leave first important comment only | ||
// 0 - strip all important comments | ||
options.keepSpecialComments = 'keepSpecialComments' in options ? | ||
options.keepSpecialComments : | ||
'*'; | ||
// replace function | ||
@@ -103,7 +110,22 @@ if (options.debug) { | ||
// Get the special comments, content content, and spaces inside calc back | ||
var specialCommentsCount = context.specialComments.length; | ||
replace(/calc\([^\}]+\}/g, function(match) { | ||
return match.replace(/\+/g, ' + '); | ||
}); | ||
replace(/__CSSCOMMENT__/g, function() { return context.specialComments.shift(); }); | ||
replace(/__CSSCONTENT__/g, function() { return context.contentBlocks.shift(); }); | ||
replace(/__CSSCOMMENT__/g, function(i) { | ||
switch (options.keepSpecialComments) { | ||
case '*': | ||
return context.specialComments.shift(); | ||
case 1: | ||
return context.specialComments.length == specialCommentsCount ? | ||
context.specialComments.shift() : | ||
''; | ||
case 0: | ||
return ''; | ||
} | ||
}); | ||
replace(/__CSSCONTENT__/g, function() { | ||
return context.contentBlocks.shift(); | ||
}); | ||
@@ -110,0 +132,0 @@ return data.trim() // trim spaces at beginning and end |
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"main": "index.js", | ||
@@ -17,2 +17,5 @@ "bin": { | ||
}, | ||
"scripts": { | ||
"test": "node_modules/.bin/vows test/*-test.js" | ||
}, | ||
"dependencies": { | ||
@@ -19,0 +22,0 @@ "optimist": "0.3.x" |
@@ -0,1 +1,2 @@ | ||
[![build status](https://secure.travis-ci.org/GoalSmashers/clean-css.png)](http://travis-ci.org/GoalSmashers/clean-css) | ||
## What is clean-css? ## | ||
@@ -9,3 +10,4 @@ | ||
node 0.4.0+ | ||
node 0.6.0+ on *nix (fully tested on OS X 10.6+ and CentOS) | ||
node 0.8.0+ on Windows | ||
@@ -26,3 +28,3 @@ ### How to install clean-css? ### | ||
Or more likely you would like to do something like this: | ||
Or more likely you would like to do something like this (if you are on *nix system): | ||
@@ -55,2 +57,6 @@ cat one.css two.css three.css | cleancss -o merged-and-minified.css | ||
on *nix systems. If you are under Windows then run: | ||
./test.bat | ||
## Acknowledgments ## | ||
@@ -64,2 +70,2 @@ | ||
Clean-css is released under the MIT license. | ||
Clean-css is released under the MIT license. |
@@ -57,2 +57,12 @@ var vows = require('vows'), | ||
}), | ||
'strip all but first comment': pipedContext('/*!1st*//*! 2nd */a{}', '--s1', { | ||
'should keep the 2nd comment': function(error, stdout) { | ||
assert.equal(stdout, "/*!1st*/a{}"); | ||
} | ||
}), | ||
'strip all comments': pipedContext('/*!1st*//*! 2nd */a{}', '--s0', { | ||
'should keep the 2nd comment': function(error, stdout) { | ||
assert.equal(stdout, "a{}"); | ||
} | ||
}), | ||
'empty': pipedContext('a{}', '-e', { | ||
@@ -59,0 +69,0 @@ 'should preserve content': function(error, stdout) { |
@@ -152,2 +152,14 @@ var vows = require('vows'), | ||
}), | ||
'important comments - one': cssContext({ | ||
'strip all but first': [ | ||
'/*! important comment */a{color:red}/* some comment *//*! important comment */', | ||
'/*! important comment */a{color:red}' | ||
] | ||
}, { keepSpecialComments: 1 }), | ||
'important comments - none': cssContext({ | ||
'strip all': [ | ||
'/*! important comment */a{color:red}/* some comment *//*! important comment */', | ||
'a{color:red}' | ||
] | ||
}, { keepSpecialComments: 0 }), | ||
'text content': cssContext({ | ||
@@ -154,0 +166,0 @@ 'normal #1': 'a{content:"."}', |
Sorry, the diff of this file is not supported yet
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
710324
24
14117
68