Skip to content

Commit

Permalink
Fix warning: 'A PostCSS plugin did not pass the from option to postcs…
Browse files Browse the repository at this point in the history
…s.parse'
  • Loading branch information
loganbenjamin committed Oct 2, 2023
1 parent 10f2656 commit 33cd93e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/postcss-light-dark.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { atRule as postcssAtRule, decl as postcssDecl, Root } from 'postcss';
import { atRule as postcssAtRule, Root } from 'postcss';

const FUNCTION = 'light-dark(';

Expand Down Expand Up @@ -55,9 +55,9 @@ module.exports = () => {
if (regex.test(value)) {
const { light: lightVal, dark: darkVal } = getLightDarkValue(value);
const darkMixin = postcssAtRule({ name: 'mixin', params: 'dark' });
darkMixin.append(postcssDecl({ prop, value: darkVal }));
darkMixin.append(decl.clone({ value: darkVal }));
decl.parent?.insertAfter(decl, darkMixin);
decl.parent?.insertAfter(decl, postcssDecl({ prop, value: lightVal }));
decl.parent?.insertAfter(decl, decl.clone({ value: lightVal }));

decl.remove();
}
Expand Down

0 comments on commit 33cd93e

Please sign in to comment.