-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cadfa50
commit af9b1f8
Showing
1 changed file
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:/ | |
|
||
|
||
## Features | ||
- Webpack for building | ||
- Use Webpack for building | ||
- Sass ready (sass-loader). Just ```import 'your/sass/files.scss'``` from your components | ||
- ES2016 ready (babel loader). | ||
- Import images ready (url-loader). Just ```import myImage from 'my/image/dir'``` | ||
- Import images from your components (url-loader). Just ```import myImage from 'my/image/dir/my_image.png'``` | ||
|
||
## How to use | ||
1. Clone the repo: ```git clone [email protected]:nmartinezb3/npm-react-component-starter.git``` | ||
2. Change package name, author, and all stuff in ```package.json``` | ||
3. Install all dependencies: ```npm install``` | ||
4. Create your components under ```src/components/``` | ||
5. Export them from from src/index.js: | ||
5. Export them from ```src/index.js```: | ||
``` | ||
import MyComponent from './components/MyComponent'; | ||
import MyOtherComponent from './components/MyOtherComponent'; | ||
export { | ||
MyComponent, | ||
MyOtherComponent | ||
} | ||
``` | ||
|
||
6. Make a build: ```npm run build``` | ||
7. Publish to npm: ```npm publish``` (You must have an npm account) | ||
8. Now you are ready to install the package with ```npm install my-react-components``` | ||
7. Publish to npm: ```npm publish``` (you must have an npm account) | ||
8. Install the package from other project: ```npm install my-react-components``` | ||
9. Import the components: ```import { MyComponent, MyOtherComponent } from 'my-react-components'``` | ||
|
||
|
||
## Preview components during develop | ||
|