[3.2.0 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.1.1...HEAD)
==================
+* Makes `root` option implicitely default to `process.cwd()`.
* Fixed issue [#376](https://github.com/jakubpawlowicz/clean-css/issues/376) - option to disable `0[unit]` -> `0`.
* Fixed issue [#396](https://github.com/jakubpawlowicz/clean-css/issues/396) - better input source maps tracking.
* Fixed issue [#480](https://github.com/jakubpawlowicz/clean-css/issues/480) - extracting uppercase property names.
benchmark: options.benchmark,
compatibility: new Compatibility(options.compatibility).toOptions(),
debug: options.debug,
+ explicitRoot: !!options.root,
inliner: options.inliner || {},
keepBreaks: options.keepBreaks || false,
keepSpecialComments: 'keepSpecialComments' in options ? options.keepSpecialComments : '*',
rebase: undefined === options.rebase ? true : !!options.rebase,
relativeTo: options.relativeTo,
restructuring: undefined === options.restructuring ? true : !!options.restructuring,
- root: options.root,
+ root: options.root || process.cwd(),
roundingPrecision: options.roundingPrecision,
shorthandCompacting: !!options.sourceMap ? false : (undefined === options.shorthandCompacting ? true : !!options.shorthandCompacting),
sourceMap: options.sourceMap,
var options = this.outerContext.options;
var rebaseOpts = {
- absolute: !!options.root,
- relative: !options.root && !!options.target,
+ absolute: options.explicitRoot,
+ relative: !options.explicitRoot && !!options.target,
fromBase: options.relativeTo
};
}
ImportInliner.prototype.process = function (data, context) {
- var root = this.outerContext.options.root || process.cwd();
+ var root = this.outerContext.options.root;
context = override(context, {
baseRelativeTo: this.outerContext.options.relativeTo || root,
source: undefined
};
- if (this.minifyContext.options.root)
+ if (this.minifyContext.options.explicitRoot)
context.resolvePath = absolutePathResolver(context);
else if (this.minifyContext.options.target)
context.resolvePath = relativePathResolver(context);
}
function relativePathResolver(context) {
- var rebaseTo = path.resolve(process.cwd(), context.outer.options.target);
+ var rebaseTo = path.resolve(context.outer.options.root, context.outer.options.target);
if (!fs.existsSync(rebaseTo) || fs.statSync(rebaseTo).isFile())
rebaseTo = path.dirname(rebaseTo);
function fromHash(outerContext, sources) {
var data = [];
- var toBase = path.resolve(outerContext.options.target || process.cwd());
+ var toBase = path.resolve(outerContext.options.target || outerContext.options.root);
for (var source in sources) {
var styles = sources[source].styles;
var inputSourceMap = sources[source].sourceMap;
var rewriter = new UrlRewriter({
- absolute: !!outerContext.options.root,
- relative: !outerContext.options.root,
+ absolute: outerContext.options.explicitRoot,
+ relative: !outerContext.options.explicitRoot,
imports: true,
urls: outerContext.options.rebase,
fromBase: path.dirname(path.resolve(source)),