Skip to content

Commit

Permalink
[nextjs][bug] Transform !important css to an intermediate representat…
Browse files Browse the repository at this point in the history
…ion (#38)
  • Loading branch information
brijeshb42 authored Apr 29, 2024
1 parent 0a75015 commit bd2be95
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export const loader = function virtualFileLoader() {
const callback = this.async();
const resourceQuery = this.resourceQuery.slice(1);
const { source } = JSON.parse(decodeURIComponent(resourceQuery));
return callback(null, source);
return callback(null, source.replaceAll('__IMP__', '!important'));
};
2 changes: 1 addition & 1 deletion packages/pigment-css-unplugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export const plugin = createUnplugin<PigmentOptions, true>((options) => {
const data = `${meta.placeholderCssFile}?${encodeURIComponent(
JSON.stringify({
filename: id.split('/').pop(),
source: cssText,
source: cssText.replaceAll('!important', '__IMP__'),
}),
)}`;
return {
Expand Down
1 change: 1 addition & 0 deletions packages/pigment-css-unplugin/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"resolveJsonModule": true,
"target": "ES2022",
"lib": ["ES2021", "DOM"],
"paths": {
"@babel/core": ["./node_modules/@babel/core"],
"@pigment-css/react": ["./packages/pigment-css-react/src"],
Expand Down

0 comments on commit bd2be95

Please sign in to comment.