CSS Modules if using React and Webpack?

Will CSS go the way of JavaScript with modules?

And if already using React + Webpack?

Hello @justin

I was checking how to use bootstrap-loader.

I notice that React CSS Modules is not used by the bootstrap-loader.

For example:
<span className={css.text}>It.</span>

at: FontAwesomeIcons.jsx

Why bootstrap-loader don’t use React CSS Modules in order to be able to use css like this:

<span styleName='text'>It.</span>

I’m a Rails developer, I’d like to know your opinion about this matter.

Additionaly I found another Bootstrap css module implementation that uses React CSS Modules.


Which one is better ?

Thanks in advance.

I’m not clear on the question. bootstrap-loader is separate than using webpack for CSS modules.

From https://github.com/gajus/react-css-modules:

What’s the Problem?

webpack css-loader itself has several disadvantages:

  • You have to use camelCase CSS class names.
  • You have to use styles object whenever constructing a className.
  • Mixing CSS Modules and global CSS classes is cumbersome.
  • Reference to an undefined CSS Module resolves to undefined without a warning.

I don’t really see those as worth moving away from the simplicity of the plain webpack solution.

So I’d stick to our example: https://github.com/shakacode/react-webpack-rails-tutorial/, live at http://www.reactrails.com/.