flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

View file

@ -0,0 +1,34 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = mergeStyles;
/* Merge multiple <style> into one */
function mergeStyles(tree) {
var styleNodes = {};
tree.match({ tag: 'style' }, function (node) {
var nodeAttrs = node.attrs || {};
// Skip <style scoped></style>
// https://developer.mozilla.org/en/docs/Web/HTML/Element/style
if (nodeAttrs.scoped !== undefined) {
return node;
}
var styleType = nodeAttrs.type || 'text/css';
var styleMedia = nodeAttrs.media || 'all';
var styleKey = styleType + '_' + styleMedia;
if (styleNodes[styleKey]) {
var styleContent = (node.content || []).join(' ');
styleNodes[styleKey].content.push(' ' + styleContent);
return '';
}
node.content = node.content || [];
styleNodes[styleKey] = node;
return node;
});
return tree;
}