|
1 | | -# react-from-flex |
2 | | -React components inspired by Adobe/Apache Flex MXML. https://www.npmjs.com/package/react-from-flex |
| 1 | +# [React-from-Flex](https://github.com/faiconqg/react-from-flex) · [](https://github.com/faiconqg/react-from-flex/blob/master/LICENSE) [](https://www.npmjs.com/package/@faicon/react-from-flex) |
3 | 2 |
|
| 3 | +> <p>React components inspired by Adobe/Apache Flex MXML.</p> |
4 | 4 |
|
| 5 | +```jsx |
| 6 | +import React from 'react' |
| 7 | +import { HGroud , VGroup } from 'react-from-flex' |
5 | 8 |
|
6 | | -# Webpack library starter |
7 | | - |
8 | | -Webpack based boilerplate for producing libraries (Input: ES6, Output: universal library) |
9 | | - |
10 | | - |
11 | | - |
12 | | -## Features |
13 | | - |
14 | | -* Webpack 3 based. |
15 | | -* ES6 as a source. |
16 | | -* Exports in a [umd](https://github.com/umdjs/umd) format so your library works everywhere. |
17 | | -* ES6 test setup with [Mocha](http://mochajs.org/) and [Chai](http://chaijs.com/). |
18 | | -* Linting with [ESLint](http://eslint.org/). |
19 | | - |
20 | | -## Process |
21 | | - |
22 | | -``` |
23 | | -ES6 source files |
24 | | - | |
25 | | - | |
26 | | - webpack |
27 | | - | |
28 | | - +--- babel, eslint |
29 | | - | |
30 | | - ready to use |
31 | | - library |
32 | | - in umd format |
33 | | -``` |
34 | | - |
35 | | -*Have in mind that you have to build your library before publishing. The files under the `lib` folder are the ones that should be distributed.* |
36 | | - |
37 | | -## Getting started |
38 | | - |
39 | | -1. Setting up the name of your library |
40 | | - * Open `webpack.config.js` file and change the value of `libraryName` variable. |
41 | | - * Open `package.json` file and change the value of `main` property so it matches the name of your library. |
42 | | -2. Build your library |
43 | | - * Run `yarn install` (recommended) or `npm install` to get the project's dependencies |
44 | | - * Run `yarn build` or `npm run build` to produce minified version of your library. |
45 | | -3. Development mode |
46 | | - * Having all the dependencies installed run `yarn dev` or `npm run dev`. This command will generate an non-minified version of your library and will run a watcher so you get the compilation on file change. |
47 | | -4. Running the tests |
48 | | - * Run `yarn test` or `npm run test` |
49 | | - |
50 | | -## Scripts |
51 | | - |
52 | | -* `yarn build` or `npm run build` - produces production version of your library under the `lib` folder |
53 | | -* `yarn dev` or `npm run dev` - produces development version of your library and runs a watcher |
54 | | -* `yarn test` or `npm run test` - well ... it runs the tests :) |
55 | | -* `yarn test:watch` or `npm run test:watch` - same as above but in a watch mode |
56 | | - |
57 | | -## Readings |
58 | | - |
59 | | -* [Start your own JavaScript library using webpack and ES6](http://krasimirtsonev.com/blog/article/javascript-library-starter-using-webpack-es6) |
60 | | - |
61 | | -## Misc |
62 | | - |
63 | | -### An example of using dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle |
64 | | - |
65 | | -In the following example we are excluding React and Lodash: |
66 | | - |
67 | | -```js |
68 | | -{ |
69 | | - devtool: 'source-map', |
70 | | - output: { |
71 | | - path: '...', |
72 | | - libraryTarget: 'umd', |
73 | | - library: '...' |
74 | | - }, |
75 | | - entry: '...', |
76 | | - ... |
77 | | - externals: { |
78 | | - react: 'react' |
79 | | - // Use more complicated mapping for lodash. |
80 | | - // We need to access it differently depending |
81 | | - // on the environment. |
82 | | - lodash: { |
83 | | - commonjs: 'lodash', |
84 | | - commonjs2: 'lodash', |
85 | | - amd: '_', |
86 | | - root: '_' |
87 | | - } |
| 9 | +class Sample extends React.Component { |
| 10 | + render() { |
| 11 | + <HGroup> |
| 12 | + <VGroup> |
| 13 | + </VGroup> |
| 14 | + </HGroup> |
88 | 15 | } |
89 | 16 | } |
90 | | -``` |
| 17 | + |
| 18 | +export default Sample; |
| 19 | +``` |
0 commit comments