Skip to content

Don't replace variables not specified in variables#5

Open
hughsk wants to merge 1 commit intoreworkcss:masterfrom
hughsk:variable-fix
Open

Don't replace variables not specified in variables#5
hughsk wants to merge 1 commit intoreworkcss:masterfrom
hughsk:variable-fix

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