Skip to content

Latest commit

 

History

History
84 lines (52 loc) · 2.25 KB

README.usage.md

File metadata and controls

84 lines (52 loc) · 2.25 KB

Usage

This project supports Node v4+ and npm 2+ installed in your development toolchain.

Install and save in your package.json:

npm install @pearson-components/[component-name] --save

External Dependencies

React and ReactDOM (v0.14 or v15) are external dependencies required to use this component. They are npm-installable or available from a third-party CDN.

This component targets the styling in the Pearson Elements SDK.

Cross-browser Compatibility

The following Polyfill.io service is recommended for consuming this component cross-browser:

<script src="https://cdn.polyfill.io/v2/polyfill.js?features=CustomEvent,Intl.~locale.en,Intl.~locale.fr"></script>

The CustomEvent polyfill is for Internet Explorer, and the Intl.js polyfill is for Safari. As you support more languages, add them to the list of features requested.

If your browser already supports a feature, this service automatically optimizes and does not bring down unnecessary code.

How to Consume in an Application

To launch your local server use:

npm run dev

See the /demo directory for example usage.

Both the component's original source code and the transpiled UMD bundle are available in the npm installation.

Use the source when you want to use this project as a sub-component dependency that is referenced in the JSX of your parent component.

Use the bundled version when you want to drop in the component on your page and instantiate in a DOM element.

Bundle (Simplest)

The transpiled, minified bundle will be available in /node_modules in the component /build directory.

Eventing example:

[EXAMPLE GOES HERE]

or Build

There are use cases where you might need to roll the component into your application's build process.

CommonJS example:

[EXAMPLE GOES HERE]

Example webpack configuration (requires correct configuration and installation of loader dependencies):

[EXAMPLE GOES HERE]

Component Configuration

[CONFIG EXAMPLE GOES HERE]

Eventing

Eventdetail