Skip to content

Remove false props before generating styles #113

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

Conversation

andreruffert
Copy link

This PR adds a filter to remove false props to prevent generating undefined style properties.

Example props
{ fontSize: '16px', fontFamily: undefined }

The above props would generate the following styles:

.iRGQtx {
  font-size: 16px;
  font-family: undefined;
}

The new feature here is filtering false props before generating and injecting the styles.
The new styles now look like this:

.iRGQtx {
  font-size: 16px;
}

Related: #102

@andreruffert andreruffert marked this pull request as ready for review July 1, 2020 10:48
@andreruffert
Copy link
Author

@liqueflies any opinion on that?

Prevents generating `undefined` style properties e.g

`{ fontSize: '16px', fontFamily: undefined }`

The above props would generate the following styles:

```
font-size: 16px;
font-family: undefined;
```

The new feature is filtering false props before generating and injecting the styles. The new styles now look something like this:

```
font-size: 16px;
```

More details: styled-components#102
@andreruffert andreruffert force-pushed the remove-false-props-before-generate-styles branch from b548e42 to d481383 Compare July 30, 2020 12:54
@fatlinesofcode
Copy link

can this be merged in the next release?

liqueflies added a commit that referenced this pull request Nov 28, 2020
@liqueflies
Copy link
Collaborator

Solved merging #111

@liqueflies liqueflies closed this Nov 28, 2020
@andreruffert andreruffert deleted the remove-false-props-before-generate-styles branch November 30, 2020 09:47
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.

3 participants