Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable Visitor Wrong Transform #723

Open
vsn4ik opened this issue Apr 19, 2024 · 1 comment
Open

Variable Visitor Wrong Transform #723

vsn4ik opened this issue Apr 19, 2024 · 1 comment

Comments

@vsn4ik
Copy link

vsn4ik commented Apr 19, 2024

Input:

import { transform } from 'lightningcss';

const res = transform({
  filename: 'test.css',
  minify: true,
  code: Buffer.from(`
    .foo {
      margin: var(--margin-y) 0; 
    }
  `),
  visitor: {
    Variable(variable) {
      return {
        raw: '30px'
      };
      
      // Same problem
      return {
        type: 'length',
        value: {
          unit: 'px',
          value: 30
        }
      };
    }
  }
});

console.log(res.code.toString());

Expected output:

.foo{margin:30px 0}

Actual output:

.foo{margin:30px0}
@vsn4ik vsn4ik changed the title Variable Visitor RawValue Wrong Transform Variable Visitor Wrong Transform Apr 19, 2024
@Lalem001
Copy link

Lalem001 commented Apr 22, 2024

This issue was mentioned in a comment before, and needs more attention imo: #554 (comment)

Here is their playground link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants