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

Convert string and ident interpolations to proper Stylus code #79

Open
kizu opened this issue May 7, 2014 · 2 comments
Open

Convert string and ident interpolations to proper Stylus code #79

kizu opened this issue May 7, 2014 · 2 comments
Labels

Comments

@kizu
Copy link

kizu commented May 7, 2014

Take this Scss example:

.foo {
  content: "he#{'ll'}o";
  position: abs#{'ol'}ute;
}

Right now it converts to a code that throws an error:

.foo
  content: "he{"ll"}o"
  position: abs{"ol"}ute

While we'd need to convert it into something like this:

.foo
  content: "he" + 'll' +"o"
  position: unquote('abs' + "ol" + 'ute')
  1. When the interpolation is inside the string, we need to convert it just into the string concatenation.
  2. When the interpolation is inside an ident, we need to convert it into an unquote with the string concatenation inside.

(there could be other cases with the interpolation I didn't cover there though)

@samccone samccone added the bug label May 7, 2014
@samccone
Copy link
Contributor

samccone commented May 7, 2014

thanks @kizu

@brossi
Copy link

brossi commented Aug 25, 2015

Here's another example of an interpolation error:

original.scss

@mixin circle-animation-details($name){
    #{$name}animation-name: spin;
    #{$name}animation-duration: 1250ms;
    #{$name}animation-iteration-count: infinite;
    #{$name}animation-timing-function: linear;
}

output.styl

circle-animation-details($name)
  {(interpolation nil $name nil), "animation-name"}: spin
  {(interpolation nil $name nil), "animation-duration"}: 1250ms
  {(interpolation nil $name nil), "animation-iteration-count"}: infinite
  {(interpolation nil $name nil), "animation-timing-function"}: linear

correct.styl

circle-animation-details($name)
  {'$name' + 'animation-name'}: spin
  {'$name' + 'animation-duration'}: 1250ms
  {'$name' + 'animation-iteration-count'}: infinite
  {'$name' + 'animation-timing-function'}: linear

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

No branches or pull requests

3 participants