Skip to content

Commit

Permalink
Merge pull request #1 from Scout-NU/docs
Browse files Browse the repository at this point in the history
Docs and keywords
  • Loading branch information
aem authored Mar 19, 2018
2 parents c87aa41 + aa7b9ed commit 13da79f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,58 @@ This repository serves as a boilerplate project to get started with a client-sid

When Scout started its first Prismic project, we found the resources around a React implementation to be quite scarce. As a result, we created several wrappers and utilities to make working with Prismic a bit more pleasant.

## Usage

We highly recommend using a package manager and a bundler with this library. First, install the module:

```bash
# NPM 5+
npm i react react-dom react-router-dom prismic-javascript prismic-react-router

# NPM < 5
npm i --save react react-dom react-router-dom prismic-javascript prismic-react-router

# Yarn
yarn add react react-dom react-router-dom prismic-javascript prismic-react-router
```

Then, import based on your stack:

#### CommonJS

```js
// import the entire package
const PrismicReactRouter = require('prismic-react-router');

// just a single module
const PrismicPage = require('prismic-react-router').PrismicPage;
```

#### ES Modules

```js
// import the entire package
import * as PrismicReactRouter from 'prismic-react-router';

// just a single module
import { PrismicPage } from 'prismic-react-router';
```

#### UMD

If you're not using a bundler and would like a UMD build, no worries! We've got that too:

```html
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/react-router-dom/umd/react-router-dom.min.js"></script>
<script src="https://unpkg.com/prismic-javascript"></script>
<script src="https://unpkg.com/prismic-react-router@latest/dist/umd/prismic-react-router.js"></script>
<script>
var PrismicPage = window.PrismicReactRouter;
</script>
```

## API

### `PrismicPage(Page: React.Component, Loading: React.Component?, NotFound: React.Component?)`
Expand Down Expand Up @@ -128,7 +180,7 @@ All Scout libraries are [ISC-licensed](/LICENSE). tl;dr: you can use this code h

## About Scout

<p align="center">
<p align="center">
<img src="https://web.northeastern.edu/scout/wp-content/themes/scout/images/logo.png" alt="Scout Logo" />
</p>

Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"twitter": "amarkon88"
}
],
"keywords": [
"prismic",
"react",
"router",
"react-router"
],
"bugs": {
"url": "https://github.com/Scout-NU/prismic-react-router/issues/new"
},
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
output: {
libraryTarget: 'umd',
library: 'PrismicReactStarter',
library: 'PrismicReactRouter',
},
externals: {
react: 'react',
Expand Down

0 comments on commit 13da79f

Please sign in to comment.