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

Don't replace variables not specified in variables #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hughsk
Copy link

@hughsk hughsk commented Feb 25, 2014

Unsure if it's the current intended behavior, but if a variable is falsey or undefined, it'll just remove the $ symbol and leave the variable name there.

For example:

body {
  margin: $body-margin;
  padding: $body-padding;
}

Using:

rework(str).use(variables({
  'body-margin': '20px'
})).toString()

Currently results in:

body {
  margin: 20px;
  padding: body-padding;
}

Meaning that any future applications of rework-variables anywhere else won't be able to pick up the missing variable and replace it. This patch changes the ouptut of the above example to be:

body {
  margin: 20px;
  padding: $body-padding;
}

Thanks! :)

@jonathanong
Copy link
Contributor

can you add tests?

btw i recommend just using https://github.com/reworkcss/rework-vars since it actually somewhat complies with a spec

@jonathanong
Copy link
Contributor

you still interested in this? i can just add you to the org if you want to maintain this

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

Successfully merging this pull request may close these issues.

2 participants