UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

18 lines 835 B
import "core-js/modules/es.string.replace.js"; import { getVersion, getSha } from '../../shared/build-info/BuildInfo.js'; const slugify = s => String(s).toLowerCase().replace(/[^a-z0-9-]/g, '_'); export const getStyleScopeHash = function () { let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; const version = (opts === null || opts === void 0 ? void 0 : opts.version) || getVersion(); const isVersion = String(version).match(/^\d/); const isBranch = String(version).includes('/'); if (isVersion) { return slugify(`eufemia-scope--${version}`); } if (isBranch) { const sha = (opts === null || opts === void 0 ? void 0 : opts.sha) || getSha(); return slugify(`eufemia-scope--${sha}`); } return 'eufemia-scope--default'; }; //# sourceMappingURL=plugin-scope-hash.js.map