Skip to content

Commit

Permalink
Merge pull request #181 from PrestaShopCorp/prefix-preflight-of-tailwind
Browse files Browse the repository at this point in the history
Prefix CSS rules to avoid impacting pages in which the components are integrated
  • Loading branch information
aAmorim27 authored Sep 5, 2023
2 parents 5dd6a8b + d80e7e1 commit c6e04e5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"jsdom": "^22.1.0",
"lint-staged": "^13.2.3",
"postcss": "^8.4.25",
"postcss-prefix-selector": "^1.16.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.63.6",
Expand Down
19 changes: 15 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
autoprefixer: {},
'postcss-prefix-selector': {
prefix: '#psaccounts',
transform: function(prefix, selector, prefixedSelector) {
if (selector.match(/^(html|body)/)) {
return selector.replace(/^([^\s]*)/, `$1 ${prefix}`);
} else if (selector.match(/^(\#psaccounts)/)) {
return selector;
} else {
return prefixedSelector;
}
}
},
}
};
2 changes: 1 addition & 1 deletion src/components/panel/AccountPanel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<puik-card
class="acc-p-6"
class="!acc-p-6"
>
<div class="acc-flex acc-flex-row acc-items-center">
<PuikIcon
Expand Down

0 comments on commit c6e04e5

Please sign in to comment.