react-time-to-tea
v0.0.3
Published
Auto add components
Downloads
5
Readme
🍵 Time to tea
Way to add react components to components/index.js
automatically when server is starting.
Usage
Install package:
npm install react-time-to-tea --save-dev
Add to the server.js
:
import setComponents from 'react-time-to-tea';
// Set all components from `./path-to-components/` to `./path-to-components/index.js`
setComponents('./path-to-components/');
Example
In this example we add containers
and components
:
import setComponents from 'react-time-to-tea';
const components = [
'./src/containers', // folder with containers
'./src/components', // folder with components
];
components.map(dir => setComponents(dir));
Args
setComponents(dir, componentNameAsDir);
directory
(String) - path to componentscomponentNameAsDir
(boolean) - true: export component likepath-to-component/ComponentName/ComponentName.js
, false: export component likepath-to-component/ComponentName
this means that component has nameindex.js
, default:false
🍵 So now you have time to tea
License
MIT