Skip to content

Commit c59a05d

Browse files
jjinuxgajus
authored andcommitted
docs: add notes about migration (gajus#180)
* Added some notes on porting * docs: update wording
1 parent c4f4ea0 commit c59a05d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ In contrast to [`react-css-modules`](https://github.com/gajus/react-css-modules)
3232
* [Limitations](#limitations)
3333
* [Have a question or want to suggest an improvement?](#have-a-question-or-want-to-suggest-an-improvement)
3434
* [FAQ](#faq)
35+
* [How to migrate from react-css-modules to babel-plugin-react-css-modules?](#how-to-migrate-from-react-css-modules-to-babel-plugin-react-css-modules)
3536
* [How to reference multiple CSS modules?](#how-to-reference-multiple-css-modules)
3637
* [How to live reload the CSS?](#hot-to-live-reload-the-css)
3738

@@ -446,6 +447,19 @@ const _styleModuleImportMap = {
446447

447448
## FAQ
448449

450+
### How to migrate from react-css-modules to babel-plugin-react-css-modules?
451+
452+
Follow the following steps:
453+
454+
* Remove `react-css-modules`.
455+
* Add `babel-plugin-react-css-modules`.
456+
* Configure `.babelrc` (see [Configuration](#configuration)).
457+
* Remove all uses of the `cssModules` decorator and/or HoC.
458+
459+
If you are still having problems, refer to one of the user submitted guides:
460+
461+
* [Porting from react-css-modules to babel-plugin-react-css-modules (with Less)](http://www.jjinux.com/2018/04/javascript-porting-from-react-css.html)
462+
449463
### How to reference multiple CSS modules?
450464

451465
`react-css-modules` had an option [`allowMultiple`](https://github.com/gajus/react-css-modules#allowmultiple). `allowMultiple` allows multiple CSS module names in a `styleName` declaration, e.g.
@@ -456,7 +470,7 @@ const _styleModuleImportMap = {
456470

457471
This behaviour is enabled by default in `babel-plugin-react-css-modules`.
458472

459-
## How to live reload the CSS?
473+
### How to live reload the CSS?
460474

461475
`babel-plugin-react-css-modules` utilises webpack [Hot Module Replacement](https://webpack.github.io/docs/hot-module-replacement.html) (HMR) to live reload the CSS.
462476

0 commit comments

Comments
 (0)