* Fixed issue [#517](https://github.com/jakubpawlowicz/clean-css/issues/517) - turning off color optimizations.
* Fixed issue [#542](https://github.com/jakubpawlowicz/clean-css/issues/542) - space after closing brace in IE.
* Fixed issue [#574](https://github.com/jakubpawlowicz/clean-css/issues/574) - rewriting internal URLs.
+* Fixed issue [#575](https://github.com/jakubpawlowicz/clean-css/issues/575) - missing directory as a `target`.
[3.2.10 / 2015-05-14](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.9...v3.2.10)
==================
shorthandCompacting: undefined === options.shorthandCompacting ? true : !!options.shorthandCompacting,
sourceMap: options.sourceMap,
sourceMapInlineSources: !!options.sourceMapInlineSources,
- target: options.target && fs.existsSync(options.target) && fs.statSync(options.target).isDirectory() ? options.target : path.dirname(options.target)
+ target: !options.target || missingDirectory(options.target) || presentDirectory(options.target) ? options.target : path.dirname(options.target)
};
this.options.inliner.timeout = this.options.inliner.timeout || DEFAULT_TIMEOUT;
this.options.inliner.request = this.options.inliner.request || {};
};
+function missingDirectory(filepath) {
+ return !fs.existsSync(filepath) && !/\.css$/.test(filepath);
+}
+
+function presentDirectory(filepath) {
+ return fs.existsSync(filepath) && fs.statSync(filepath).isDirectory();
+}
+
CleanCSS.prototype.minify = function(data, callback) {
var context = {
stats: {},
root: process.cwd(),
relativeTo: path.join('test', 'fixtures', 'partials-relative')
}),
- 'urls rewriting - no root but target': cssContext({
+ 'urls rewriting - no root but target as file': cssContext({
'no @import': [
'a{background:url(../partials/extra/down.gif) no-repeat}',
'a{background:url(test/fixtures/partials/extra/down.gif) no-repeat}'
target: process.cwd(),
relativeTo: path.join('test', 'fixtures', 'partials-relative')
}),
+ 'urls rewriting - no root but target as a missing directory': cssContext({
+ 'url': [
+ 'a{background:url(../partials/extra/down.gif) no-repeat}',
+ 'a{background:url(../fixtures/partials/extra/down.gif) no-repeat}'
+ ],
+ 'relative @import': [
+ '@import url(base.css);',
+ 'a{background:url(../fixtures/partials/extra/down.gif) no-repeat}'
+ ],
+ 'absolute @import': [
+ '@import url(/test/fixtures/partials-relative/base.css);',
+ 'a{background:url(../fixtures/partials/extra/down.gif) no-repeat}'
+ ]
+ }, {
+ target: path.join('test', 'fixtures2'),
+ relativeTo: path.join('test', 'fixtures', 'partials-relative')
+ }),
'urls rewriting - root and target': cssContext({
'no @import': [
'a{background:url(../partials/extra/down.gif) no-repeat}',