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

when I define a javascript hash variable I can't get expected iteration result. #2780

Closed
hooozen opened this issue Mar 29, 2023 · 3 comments
Closed

Comments

@hooozen
Copy link
Contributor

hooozen commented Mar 29, 2023

To reproduce:

var stylus = require('stylus');

str = `
.foo 
  for k, v in obj
    {k}: v;
`
stylus(str)
  .set('filename', 'nesting.css')
  .define("obj", { display: 'block', color: 'white' })
  .render(function (err, css) {
    if (err) throw err;
    console.log(css);
  })

Current behavior:

.foo {
  display: 0;
  color: 1;
}

Expected behavior:

.foo {
  display: block;
  color: white;
}

Environment information:

  • stylus version: 0.59.0
  • nodejs version: 18.5.0
@hooozen
Copy link
Contributor Author

hooozen commented Mar 30, 2023

I found the solution from #1286
Just add a raw parameter:

  .define("obj", { display: 'block', color: 'white' }, true)

The document may need an update.

@iChenLei
Copy link
Member

doc pr welcome, thanks

@iChenLei
Copy link
Member

cloesd by #2781

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