Ad

How To Incorporate CoreUI To React Rails App?

- 1 answer

I want to add CoreUI to my react rails app.
I know there is the npm package: @coreui/react
But I don't know how to import it into my react project...

Thanks!

Ad

Answer

Okay so I installed coreui react templates in my rails app.

1/ download coreui react template here (https://github.com/coreui/coreui-free-react-admin-template)
2/ rails new coreui-react-rails-app --webpack=react
3/ install all dependencies of package.json of coreui template in your app

"@coreui/coreui": "^2.1.12",
"@coreui/coreui-plugin-chartjs-custom-tooltips": "^1.3.1",
"@coreui/icons": "0.3.0",
"@coreui/react": "^2.5.1",
"bootstrap": "^4.3.1",
"chart.js": "^2.8.0",
"classnames": "^2.2.6",
"core-js": "^3.1.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"flag-icon-css": "^3.3.0",
"font-awesome": "^4.7.0",
"node-sass": "^4.12.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-app-polyfill": "^1.0.1",
"react-chartjs-2": "^2.7.6",
"react-dom": "^16.8.6",
"react-router-config": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-test-renderer": "^16.8.6",
"reactstrap": "^8.0.0",
"simple-line-icons": "^2.4.1"  

4/ move all src/ contents in app/javascript/ folder of your rails app
5/ move index.js into packs webpack folder (in app/javascript/packs)
6/ move your scss folder and content of App.scss in your app/assets/stylesheets (load with webpack) 7/ link rails with your packs/index.js file
8/ that's it!

Please tell me if you have a problem!

Ad
source: stackoverflow.com
Ad