27 lines
566 B
JavaScript
27 lines
566 B
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports['default'] = jssPropsSort;
|
|
/**
|
|
* Sort props by length.
|
|
*/
|
|
function jssPropsSort() {
|
|
function sort(prop0, prop1) {
|
|
return prop0.length - prop1.length;
|
|
}
|
|
|
|
function onProcessStyle(style, rule) {
|
|
if (rule.type !== 'style') return style;
|
|
|
|
var newStyle = {};
|
|
var props = Object.keys(style).sort(sort);
|
|
for (var prop in props) {
|
|
newStyle[props[prop]] = style[props[prop]];
|
|
}
|
|
return newStyle;
|
|
}
|
|
|
|
return { onProcessStyle: onProcessStyle };
|
|
} |