UNPKG

host-css-variable

Version:

This is a library that pseudo-encapsulates host CSS variables for component based architectures.

19 lines 733 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.customPropertyResolver = void 0; function customPropertyResolver(content) { var match, cur, start, end; var REGEX = /(\;|\{|\s)\-\-.+\:(.*)/g; while (match = REGEX.exec(content)) { start = cur = match.index; while (cur < content.length && ![';', '{', '}'].includes(content[cur])) cur++; end = cur; content = content.slice(0, start) + content.substring(start, end).replace(/(?!#{)(hvar\(.*\))(?!})/g, "#{$1}") + content.slice(end); } return content; } exports.customPropertyResolver = customPropertyResolver; //# sourceMappingURL=custom-property-resolver.js.map