gajus / gajus/babel-plugin-react-css-modules

Working with state classes

Open
#273 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

We are using this library in 2 of our projects and works really well.
But one of the practices that we usually use are "State classes" like http://smacss.com/book/type-state

for example if we have
```


```

this element can sometimes have this class
```


```

To try to style things like this we had to use multiple modules and have a CSS like:
```
.menu__item {
color: red;
}

.is-active {
color: blue;
}
```

ideally we would like to use
```
.menu__item {
color: red;

&.is-active {
color: blue;
}
}
```

But ok we can more or less work, the problem is when you have something inside `menu__item`
```




```

In that case we cannot do that:
```
.menu__item {
color: red;
}

.is-active {
color: blue;

.menu__icon {
color: yellow;
}
}
```
or ideally:

```
.menu {
&__item {
color: red;

&.is-active {
color: blue;
}
}

&__item.is-active &__icon {
color: yellow;
}
}
```

Are you planning some feature to "disable" selectors that start with a prefix?
For example, for us can be useful to ignore "is-", "u-", etc...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.