Create-react-app: Meaningful local css selector names

Created on 3 Jun 2017  路  4Comments  路  Source: facebook/create-react-app

At the moment local css selector names compiles to meaningless hashes.
For example: :local .foo{} compiles to: ._15QQawvrl5PrjGf9wGoYAO{}

Would be better if original names were prepended to hashes after compilation.

question

All 4 comments

Weird.
My build has no that kind of hash-names.

For example, this was my last build deployed (link may be broken in a few days after next deploy).

What do you do to get those classnames?
Did you ejected create-react-add and changed something in configs?

It works when I import css and mark it as local.
For example:

Inside style.css
:local .foo{}

Inside component.jsx

import style from ./style.css

<div className={style.foo}></div>

See https://github.com/facebookincubator/create-react-app/issues/90. :local is a css module syntax. There's a PR open to add css modules for .module.css in https://github.com/facebookincubator/create-react-app/pull/2285 which is in progress

We currently don't support CSS Modules and they work accidentally (because we didn't explicitly disable them).
Please do not be surprised if they break until #2285 is merged; see #90 for history as suggested by @kennethtruong.

I'll close this as a dup. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fson picture fson  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments

rdamian3 picture rdamian3  路  3Comments

fson picture fson  路  3Comments

Aranir picture Aranir  路  3Comments