* Fixed issue [#570](https://github.com/jakubpawlowicz/clean-css/issues/570) - rebasing "no-url()" imports.
* 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`.
+* Fixed issue [#577](https://github.com/jakubpawlowicz/clean-css/issues/577) - `background-clip` into shorthand.
[3.2.10 / 2015-05-14](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.9...v3.2.10)
==================
* `originalSize` - original content size (after import inlining)
* `minifiedSize` - optimized content size
* `timeSpent` - time spent on optimizations
- * `efficiency` - a ratio of output size to input size (e.g. 25% if content was reduced from 100 bytes to 75 bytes)
-
+ * `efficiency` - a ratio of output size to input size (e.g. 25% if content was reduced from 100 bytes to 75 bytes)
+
#### How to make sure remote `@import`s are processed correctly?
In order to inline remote `@import` statements you need to provide a callback to minify method, e.g.:
* `'[+-]colors.opacity'` - - turn on (+) / off (-) `rgba()` / `hsla()` declarations removal
* `'[+-]properties.backgroundSizeMerging'` - turn on / off background-size merging into shorthand
+* `'[+-]properties.backgroundClipMerging'` - turn on / off background-clip merging into shorthand
* `'[+-]properties.colors'` - turn on / off any color optimizations
* `'[+-]properties.iePrefixHack'` - turn on / off IE prefix hack removal
* `'[+-]properties.ieSuffixHack'` - turn on / off IE suffix hack removal
component = left.components.filter(nameMatchFilter(right))[0];
if (everyCombination(mayOverride, component, right, validator)) {
- var disabledBackgroundSizeMerging = !compatibility.properties.backgroundSizeMerging && component.name.indexOf('background-size') > -1;
+ var disabledBackgroundMerging =
+ !compatibility.properties.backgroundClipMerging && component.name.indexOf('background-clip') > -1 ||
+ !compatibility.properties.backgroundSizeMerging && component.name.indexOf('background-size') > -1;
var nonMergeableValue = compactable[right.name].nonMergeableValue === right.value[0][0];
- if (disabledBackgroundSizeMerging || nonMergeableValue)
+ if (disabledBackgroundMerging || nonMergeableValue)
continue;
if (!compatibility.properties.merging && wouldBreakCompatibility(left, validator))
},
properties: {
backgroundSizeMerging: false, // background-size to shorthand
+ backgroundClipMerging: false, // background-clip to shorthand
colors: true, // any kind of color transformations, like `#ff00ff` to `#f0f` or `#fff` into `red`
iePrefixHack: false, // underscore / asterisk prefix hacks on IE
ieSuffixHack: false, // \9 suffix hacks on IE
},
properties: {
backgroundSizeMerging: false,
+ backgroundClipMerging: false,
colors: true,
iePrefixHack: true,
ieSuffixHack: true,
},
properties: {
backgroundSizeMerging: false,
+ backgroundClipMerging: false,
colors: true,
iePrefixHack: true,
ieSuffixHack: true,
'inside background shorthand': [
'div{background:content-box #000}',
'div{background:content-box #000}'
- ],
- 'into background shorthand': [
- 'div{background:#000;background-clip:content-box}',
- 'div{background:padding-box content-box #000}'
]
}),
'background-origin': cssContext({
'div{background:content-box border-box #000}'
]
}),
- 'background-clip & background-origin': cssContext({
- 'into background shorthand with background clip': [
- 'div{background:#000;background-origin:content-box;background-clip:padding-box}',
- 'div{background:content-box padding-box #000}'
- ],
- 'into background shorthand merged with background clip': [
- 'div{background:border-box #000;background-clip:padding-box}',
- 'div{background:border-box padding-box #000}'
- ],
- 'with defaults': [
- 'div{background:#000;background-origin:padding-box;background-clip:border-box}',
- 'div{background:#000}'
- ]
- }),
'background size with +properties.backgroundSizeMerging': cssContext({
'with background-size property': [
'a{background:none;background-image:url(1.png);background-size:28px 28px}',
]);
}
},
+ 'shorthand then longhand - disabled background clip merging': {
+ 'topic': 'p{background:__ESCAPED_URL_CLEAN_CSS0__;background-clip:padding-box}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic, { properties: { backgroundClipMerging: false } }), [
+ [['background', false , false], ['__ESCAPED_URL_CLEAN_CSS0__']],
+ [['background-clip', false , false], ['padding-box']]
+ ]);
+ }
+ },
+ 'shorthand then longhand - enabled background clip merging': {
+ 'topic': 'p{background:__ESCAPED_URL_CLEAN_CSS0__;background-clip:padding-box}',
+ 'into': function (topic) {
+ assert.deepEqual(_optimize(topic, { properties: { backgroundClipMerging: true } }), [
+ [['background', false , false], ['__ESCAPED_URL_CLEAN_CSS0__'], ['padding-box']]
+ ]);
+ }
+ },
'shorthand then longhand - non mergeable value': {
'topic': 'p{background:__ESCAPED_URL_CLEAN_CSS0__;background-color:none}',
'into': function (topic) {
- assert.deepEqual(_optimize(topic, { properties: { backgroundSizeMerging: false } }), [
+ assert.deepEqual(_optimize(topic), [
[['background', false , false], ['__ESCAPED_URL_CLEAN_CSS0__']],
[['background-color', false , false], ['none']]
]);
assert.isTrue(options.colors.opacity);
assert.isTrue(options.properties.colors);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isFalse(options.properties.iePrefixHack);
assert.isFalse(options.properties.ieSuffixHack);
assert.isTrue(options.properties.merging);
'gets merged options': function(options) {
assert.isTrue(options.colors.opacity);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isTrue(options.properties.colors);
assert.isFalse(options.properties.iePrefixHack);
assert.isFalse(options.properties.ieSuffixHack);
'gets template options': function(options) {
assert.isFalse(options.colors.opacity);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isTrue(options.properties.colors);
assert.isTrue(options.properties.iePrefixHack);
assert.isTrue(options.properties.ieSuffixHack);
'gets template options': function(options) {
assert.isFalse(options.colors.opacity);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isTrue(options.properties.colors);
assert.isTrue(options.properties.iePrefixHack);
assert.isTrue(options.properties.ieSuffixHack);
'gets calculated options': function(options) {
assert.isTrue(options.colors.opacity);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isTrue(options.properties.colors);
assert.isFalse(options.properties.iePrefixHack);
assert.isTrue(options.properties.ieSuffixHack);
assert.isTrue(options.colors.opacity);
assert.isTrue(options.properties.colors);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isTrue(options.properties.iePrefixHack);
assert.isFalse(options.properties.ieSuffixHack);
assert.isTrue(options.properties.merging);
assert.isTrue(options.colors.opacity);
assert.isTrue(options.properties.colors);
assert.isFalse(options.properties.backgroundSizeMerging);
+ assert.isFalse(options.properties.backgroundClipMerging);
assert.isTrue(options.properties.iePrefixHack);
assert.isFalse(options.properties.ieSuffixHack);
assert.isTrue(options.properties.merging);