* Adds a better algorithm for quotation marks' removal.
* Adds a better non-adjacent optimizer compatible with the upcoming new property optimizer.
+* Adds minifying remote files directly from CLI.
* Moves quotation matching into a `QuoteScanner` class.
* Fixed issue [#134](https://github.com/GoalSmashers/clean-css/issues/134) - merges properties into shorthand form.
* Fixed issue [#164](https://github.com/GoalSmashers/clean-css/issues/164) - removes default values if not needed.
cleanOptions.inliner = { timeout: parseFloat(commands.timeout) * 1000 };
if (commands.args.length > 0) {
var relativeTo = (cleanOptions.noRebase ? false : cleanOptions.root) || commands.args[0];
- options.sources = commands.args;
cleanOptions.relativeTo = path.dirname(path.resolve(relativeTo));
+
+ options.sources = commands.args.map(function(source) {
+ var isRemote = /^https?:\/\//.test(source);
+
+ if (cleanOptions.processImport === false)
+ source += '@shallow';
+
+ return isRemote ?
+ source :
+ path.relative(cleanOptions.relativeTo, path.resolve(source));
+ });
}
// ... and do the magic!
if (options.sources) {
var data = options.sources
.map(function(source) {
- if (cleanOptions.processImport === false)
- source += '@shallow';
-
- return '@import url(' + path.relative(cleanOptions.relativeTo, path.resolve(source)) + ');';
+ return '@import url(' + source + ');';
})
.join('');
minify(data);
}
})
},
+ 'remote import': {
+ topic: function() {
+ this.server = http.createServer(function (req, res) {
+ res.writeHead(200);
+ res.end('p{font-size:13px}');
+ }).listen(31991, '127.0.0.1');
+
+ this.callback(null);
+ },
+ 'of a file': binaryContext('http://127.0.0.1:31991/present.css', {
+ succeeds: function(error, stdout) {
+ assert.equal(error, null);
+ assert.equal(stdout, 'p{font-size:13px}');
+ }
+ }),
+ teardown: function() {
+ this.server.close();
+ }
+ },
'timeout': unixOnlyContext({
topic: function() {
var self = this;