Skip to content

Commit

Permalink
Update README.md with improved importing for CDNs (#104)
Browse files Browse the repository at this point in the history
* Update README.md

Ensure both unpkg and cdnjs are listed as CDNs, deprecate existing alias CDN reference in preference for best practice explicit version, and updated wording similar to React documentation.

* Update README.md with latest minor version for CDN imports

* Fix production unpkg URL
  • Loading branch information
virgofx authored and aweary committed Oct 31, 2017
1 parent 155f4cc commit 492e230
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Expand Up @@ -20,16 +20,32 @@ import PropTypes from 'prop-types'; // ES6
var PropTypes = require('prop-types'); // ES5 with npm
```

If you prefer a `<script>` tag, you can get it from `window.PropTypes` global:
### CDN

If you prefer to exclude `prop-types` from your application and use it
globally via `window.PropTypes`, the `prop-types` package provides
single-file distributions, which are hosted on the following CDNs:

* [**unpkg**](https://unpkg.com/prop-types/)
```html
<!-- development version -->
<script src="https://unpkg.com/prop-types@15.6/prop-types.js"></script>

<!-- production version -->
<script src="https://unpkg.com/prop-types@15.6/prop-types.min.js"></script>
```

* [**cdnjs**](https://cdnjs.com/libraries/prop-types)
```html
<!-- development version -->
<script src="https://unpkg.com/prop-types/prop-types.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.js"></script>

<!-- production version -->
<script src="https://unpkg.com/prop-types/prop-types.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prop-types/15.6.0/prop-types.min.js"></script>
```

To load a specific version of `prop-types` replace `15.6.0` with the version number.

## Usage

PropTypes was originally exposed as part of the React core module, and is
Expand Down

0 comments on commit 492e230

Please sign in to comment.