UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

16 lines 706 B
import { getVersion, getSha } from '../../shared/build-info/BuildInfo.js'; const slugify = s => String(s).toLowerCase().replace(/[^a-z0-9-]/g, '_'); export const getStyleScopeHash = (opts = 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