Skip to content

Commit

Permalink
chore: overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
vladitasev committed Nov 6, 2023
1 parent 4f55134 commit 59f2978
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/tools/lib/postcss-scope-vars/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
const name = "postcss-scope-vars";

const escapeVersion = version => "v" + version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");

module.exports = (options) => {
const versionStr = "v" + options?.version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");
return {
postcssPlugin: name,
prepare() {
prepare(opts) {
const filePath = opts.root.source.input.file;
let overrideVersion;
if (filePath.includes("overrides/@ui5/webcomponents-fiori")) {
overrideVersion = require("@ui5/webcomponents-fiori/package.json").version;
} else if (filePath.includes("overrides/@ui5/webcomponents")) {
overrideVersion = require("@ui5/webcomponents/package.json").version;
}

const versionStr = escapeVersion(overrideVersion || options?.version);

return {
Declaration: (declaration) => {
if (declaration.__ui5_replaced) {
Expand Down

0 comments on commit 59f2978

Please sign in to comment.