1 | react-toolset is list of react components which can be adopted easily. It is using [classnames] module for conditional class name injection.
|
2 |
|
3 | ### Install
|
4 |
|
5 | ```sh
|
6 | # npm users
|
7 | $ npm i --save @codespec/react-toolset
|
8 |
|
9 | # yarn users
|
10 | $ yarn add @codespec/react-toolset
|
11 | ```
|
12 |
|
13 | ### Documentation
|
14 |
|
15 | - [https://codespec.github.io/react-toolset/docs/](https://codespec.github.io/react-toolset/docs/)
|
16 |
|
17 | ### How to use
|
18 |
|
19 | Since this react-toolset library is not compiling production package, you need to set up more things.
|
20 |
|
21 | 1. Install SCSS related loaders
|
22 |
|
23 | ```sh
|
24 | $ yarn add --dev sass-loader node-sass autoprefixer
|
25 | ```
|
26 |
|
27 | 2. Set up Webpack configuration
|
28 | ```js
|
29 | // Add this loaders in your webpack.config.js
|
30 | // You should not exclude node_modules directory from it.
|
31 | // This is just an example.
|
32 | module: {
|
33 | loaders: [
|
34 | {
|
35 | test: /\.jsx?$/,
|
36 | loader: 'babel-loader',
|
37 | query: {
|
38 | cacheDirectory: true,
|
39 | presets: ['es2015', 'react'],
|
40 | },
|
41 | },
|
42 | {
|
43 | test: /\.scss$/,
|
44 | use: [
|
45 | { loader: 'style-loader' },
|
46 | {
|
47 | loader: 'css-loader',
|
48 | options: {
|
49 | modules:true,
|
50 | localIdentName: '[local]-[hash:base64:5]'
|
51 | }
|
52 | },
|
53 | {
|
54 | loader: 'sass-loader',
|
55 | options: {
|
56 | plugins: () => [require('autoprefixer')]
|
57 | }
|
58 | }
|
59 | ]
|
60 | },
|
61 | ]
|
62 | }
|
63 | ```
|
64 |
|
65 | 3. Import individual component from your application
|
66 |
|
67 | ```jsx
|
68 | import Button from '@codespec/react-toolset'
|
69 | ```
|
70 |
|
71 | [classnames]: https://github.com/JedWatson/classnames
|
72 |
|
\ | No newline at end of file |