examples/dist/common.js
function generateCSSRuleset(selector, declarations, stringHandlers, useImportant) {
    var handledDeclarations = runStringHandlers(declarations, stringHandlers);

    var prefixedDeclarations = (0, _inlineStylePrefixerStatic2['default'])(handledDeclarations);

    var prefixedRules = (0, _util.flatten)((0, _util.objectToPairs)(prefixedDeclarations).map(function (_ref) {
        var _ref2 = _slicedToArray(_ref, 2);

        var key = _ref2[0];
        var value = _ref2[1];

        if (Array.isArray(value)) {
            var _ret = (function () {
                // inline-style-prefix-all returns an array when there should be
                // multiple rules, we will flatten to single rules

                var prefixedValues = [];
                var unprefixedValues = [];

                value.forEach(function (v) {
                    if (v.indexOf('-') === 0) {
                        prefixedValues.push(v);
                    } else {
                        unprefixedValues.push(v);
                    }
                });

                prefixedValues.sort();
                unprefixedValues.sort();

                return {
                    v: prefixedValues.concat(unprefixedValues).map(function (v) {
                        return [key, v];
                    })
                };
            })();

            if (typeof _ret === 'object') return _ret.v;
        }
        return [[key, value]];
    }));

    var rules = prefixedRules.map(function (_ref3) {
        var _ref32 = _slicedToArray(_ref3, 2);

        var key = _ref32[0];
        var value = _ref32[1];

        var stringValue = (0, _util.stringifyValue)(key, value);
        var ret = (0, _util.kebabifyStyleName)(key) + ':' + stringValue + ';';
        return useImportant === false ? ret : (0, _util.importantify)(ret);
    }).join("");

    if (rules) {
        return selector + '{' + rules + '}';
    } else {
        return "";
    }
}
function generateCSSRuleset(selector, declarations, stringHandlers, useImportant) {
    var handledDeclarations = runStringHandlers(declarations, stringHandlers);

    var prefixedDeclarations = (0, _inlineStylePrefixerStatic2['default'])(handledDeclarations);

    var prefixedRules = (0, _util.flatten)((0, _util.objectToPairs)(prefixedDeclarations).map(function (_ref) {
        var _ref2 = _slicedToArray(_ref, 2);

        var key = _ref2[0];
        var value = _ref2[1];

        if (Array.isArray(value)) {
            var _ret = (function () {
                // inline-style-prefix-all returns an array when there should be
                // multiple rules, we will flatten to single rules

                var prefixedValues = [];
                var unprefixedValues = [];

                value.forEach(function (v) {
                    if (v.indexOf('-') === 0) {
                        prefixedValues.push(v);
                    } else {
                        unprefixedValues.push(v);
                    }
                });

                prefixedValues.sort();
                unprefixedValues.sort();

                return {
                    v: prefixedValues.concat(unprefixedValues).map(function (v) {
                        return [key, v];
                    })
                };
            })();

            if (typeof _ret === 'object') return _ret.v;
        }
        return [[key, value]];
    }));

    var rules = prefixedRules.map(function (_ref3) {
        var _ref32 = _slicedToArray(_ref3, 2);

        var key = _ref32[0];
        var value = _ref32[1];

        var stringValue = (0, _util.stringifyValue)(key, value);
        var ret = (0, _util.kebabifyStyleName)(key) + ':' + stringValue + ';';
        return useImportant === false ? ret : (0, _util.importantify)(ret);
    }).join("");

    if (rules) {
        return selector + '{' + rules + '}';
    } else {
        return "";
    }
}
function generateCSSRuleset ( selector , declarations , stringHandlers , useImportant ) { var handledDeclarations = runStringHandlers ( declarations , stringHandlers ) ; var prefixedDeclarations = ( 0 , _inlineStylePrefixerStatic2 [ 'default' ] ) ( handledDeclarations ) ; var prefixedRules = ( 0 , _util . flatten ) ( ( 0 , _util . objectToPairs ) ( prefixedDeclarations ) . map ( function ( _ref ) { var _ref2 = _slicedToArray ( _ref , 2 ) ; var key = _ref2 [ 0 ] ; var value = _ref2 [ 1 ] ; if ( Array . isArray ( value ) ) { var _ret = ( function ( ) { // inline-style-prefix-all returns an array when there should be // multiple rules, we will flatten to single rules var prefixedValues = [ ] ; var unprefixedValues = [ ] ; value . forEach ( function ( v ) { if ( v . indexOf ( '-' ) === 0 ) { prefixedValues . push ( v ) ; } else { unprefixedValues . push ( v ) ; } } ) ; prefixedValues . sort ( ) ; unprefixedValues . sort ( ) ; return { v : prefixedValues . concat ( unprefixedValues ) . map ( function ( v ) { return [ key , v ] ; } ) } ; } ) ( ) ; if ( typeof _ret === 'object' ) return _ret . v ; } return [ [ key , value ] ] ; } ) ) ; var rules = prefixedRules . map ( function ( _ref3 ) { var _ref32 = _slicedToArray ( _ref3 , 2 ) ; var key = _ref32 [ 0 ] ; var value = _ref32 [ 1 ] ; var stringValue = ( 0 , _util . stringifyValue ) ( key , value ) ; var ret = ( 0 , _util . kebabifyStyleName ) ( key ) + ':' + stringValue + ';' ; return useImportant === false ? ret : ( 0 , _util . importantify ) ( ret ) ; } ) . join ( "" ) ; if ( rules ) { return selector + '{' + rules + '}' ; } else { return "" ; } }
Generate a CSS ruleset with the selector and containing the declarations.

This function assumes that the given declarations don't contain any special
children (such as media queries, pseudo-selectors, or descendant styles).

Note that this method does not deal with nesting used for e.g.
psuedo-selectors or media queries. That responsibility is left to  the
`generateCSS` function.

@param {string} selector: the selector associated with the ruleset
@param {Object} declarations: a map from camelCased CSS property name to CSS
property value.
@param {Object.<string, function>} stringHandlers: a map from camelCased CSS
property name to a function which will map the given value to the value
that is output.
@param {bool} useImportant: A boolean saying whether to append "!important"
to each of the CSS declarations.
@returns {string} A string of raw CSS.

Examples:

generateCSSRuleset(".blah", { color: "red" })
-> ".blah{color: red !important;}"
generateCSSRuleset(".blah", { color: "red" }, {}, false)
-> ".blah{color: red}"
generateCSSRuleset(".blah", { color: "red" }, {color: c => c.toUpperCase})
-> ".blah{color: RED}"
generateCSSRuleset(".blah:hover", { color: "red" })
-> ".blah:hover{color: red}"
Generate a CSS ruleset with the selector and containing the declarations .