File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -4,20 +4,31 @@ Sample project prepared for create and publish React components on [npm](https:/
44
55
66## Features
7- - Webpack for building
7+ - Use Webpack for building
88- Sass ready (sass-loader). Just ``` import 'your/sass/files.scss' ``` from your components
99- ES2016 ready (babel loader).
10- - Import images ready (url-loader). Just ``` import myImage from 'my/image/dir' ```
10+ - Import images from your components (url-loader). Just ``` import myImage from 'my/image/dir/my_image.png ' ```
1111
1212## How to use
13131 . Clone the repo: ``` git clone git@github.com:nmartinezb3/npm-react-component-starter.git ```
14142 . Change package name, author, and all stuff in ``` package.json ```
15153 . Install all dependencies: ``` npm install ```
16164 . Create your components under ``` src/components/ ```
17- 5 . Export them from from src/index.js:
17+ 5 . Export them from ``` src/index.js ``` :
18+ ```
19+ import MyComponent from './components/MyComponent';
20+ import MyOtherComponent from './components/MyOtherComponent';
21+
22+ export {
23+ MyComponent,
24+ MyOtherComponent
25+ }
26+ ```
27+
18286 . Make a build: ``` npm run build ```
19- 7 . Publish to npm: ``` npm publish ``` (You must have an npm account)
20- 8 . Now you are ready to install the package with ``` npm install my-react-components ```
29+ 7 . Publish to npm: ``` npm publish ``` (you must have an npm account)
30+ 8 . Install the package from other project: ``` npm install my-react-components ```
31+ 9 . Import the components: ``` import { MyComponent, MyOtherComponent } from 'my-react-components' ```
2132
2233
2334## Preview components during develop
You can’t perform that action at this time.
0 commit comments