UNPKG

fela-dom

Version:

Fela package for working with the DOM

13 lines 1.03 kB
import { objectReduce } from 'fast-loops'; export default function createStyleTagMarkup(css, type) { var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; var rehydrationIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : -1; var support = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; var styleNodeAttributes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; var mediaAttribute = media.length > 0 ? " media=\"".concat(media, "\"") : ''; var supportAttribute = support ? ' data-fela-support="true"' : ''; var userAttributes = objectReduce(styleNodeAttributes, function (attributes, value, attribute) { return attributes + ' ' + attribute + '="' + value + '"'; }, ''); return "<style type=\"text/css\" data-fela-rehydration=\"".concat(rehydrationIndex, "\" data-fela-type=\"").concat(type, "\"").concat(supportAttribute).concat(mediaAttribute).concat(userAttributes, ">").concat(css, "</style>"); }