Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify installation instructions #1181

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,38 @@ To install the stable version:
npm install --save redux
```

Most likely, you’ll also need [the React bindings](https://github.com/rackt/react-redux) and [the developer tools](https://github.com/gaearon/redux-devtools).
This requires using the [npm](https://www.npmjs.com/) package manager. It includes a [UMD](https://github.com/umdjs/umd) build, which is compatible with many popular JavaScript module loaders and environments.

#### Other Installation Methods

We **strongly** recommend using [npm](https://www.npmjs.com/) over these other options, as most of the [libraries complementary to Redux](#complementary-libraries) are only available on [npm](https://www.npmjs.com/).

However, if you don’t yet use [npm](https://www.npmjs.com/) or a modern module bundler, you have a few options.

##### Bower
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don’t want to see us contributing to “Bower is still a good choice for front-end devs” meme by even dedicating it a header. Instead, I would suggest to merge the below two sections, remove cdnjs reference and keep only npmcdn (it’s a better project IMO), and add Bower commend as an afterthought (“If you use an alternative package manager such as Bower, it is possible that your package manager allows installing libraries from URLs, for example: ”). This way it doesn’t look like we encourage it.


If you're using [Bower](http://bower.io/), this command will install the stable version of Redux:

```
bower install redux=https://npmcdn.com/redux/dist/redux.js
```

##### CDNs

Redux is available via [cdnjs](https://cdnjs.com/libraries/redux) and [npmcdn](https://npmcdn.com/redux/dist/redux.min.js). The files on these CDNs are [UMD](https://github.com/umdjs/umd) builds, which means that they will export a browser global, `window.redux`, if you're not using a tool like [Webpack](http://webpack.github.io), [Browserify](http://browserify.org/), or [RequireJS](http://requirejs.org/) to build your library.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s window.Redux, not window.redux.


An example of using the global Redux object can be seen in [the vanilla counter example](https://github.com/rackt/redux/blob/765a3a5742a591adba7ae8b61e0516c49ca594bd/examples/counter-vanilla/index.html).

#### Complementary Libraries

Most likely, you’ll also need [the React bindings](https://github.com/rackt/react-redux) and [the developer tools](https://github.com/gaearon/redux-devtools) while working with Redux.

```
npm install --save react-redux
npm install --save-dev redux-devtools
```

This assumes that you’re using [npm](https://www.npmjs.com/) package manager with a module bundler like [Webpack](http://webpack.github.io) or [Browserify](http://browserify.org/) to consume [CommonJS modules](http://webpack.github.io/docs/commonjs.html).

If you don’t yet use [npm](https://www.npmjs.com/) or a modern module bundler, and would rather prefer a single-file [UMD](https://github.com/umdjs/umd) build that makes `Redux` available as a global object, you can grab a pre-built version from [cdnjs](https://cdnjs.com/libraries/redux). We *don’t* recommend this approach for any serious application, as most of the libraries complementary to Redux are only available on [npm](https://www.npmjs.com/).
Use of the extensions requires that you’re using [npm](https://www.npmjs.com/) in conjunction with a module bundler like [Webpack](http://webpack.github.io) or [Browserify](http://browserify.org/) to consume [CommonJS modules](http://webpack.github.io/docs/commonjs.html).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the death by a thousand comments...

I'd change "Use of the extensions requires that you’re using npm" back to something like "This assumes you are using npm", so you avoid having "use" and "using" in the same sentence.

But good catch changing "npm package manager" to just "npm". That's like saying "ATM machine" 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the death by a thousand comments...

No problem at all! I want this to be good. I appreciate the thorough feedback.

I'd change "Use of the extensions requires that you’re using npm" back to something like "This assumes you are using npm", so you avoid having "use" and "using" in the same sentence.

I agree that the current wording is awkward. At the same time, I want to say something a little stronger than "this assumes," because that leaves it open that there are other methods (perhaps the CDNs above, or Bower). The existing text (before I made any changes) made it out that these tools can only be used with npm, or only with CommonJS. I just pulled down react-redux, though, and it includes a UMD build all the same. I then checked cdnjs and saw it there, too.

Perhaps the recommendation to stick with npm isn't as strong as it was originally worded, and how I've worded it to be? It looks like the three install methods (npm, Bower, CDNs) may work for all of 3 of these libraries?

If that's the case, I might want to do another restructuring to make that more clear.

Another thought is that maybe the original wording was referring to popular React libraries outside of the mini-Redux ecosystem described here. Is that the case?

Sorry I'm not more knowledgeable, I haven't used Redux much yet :)

But good catch changing "npm package manager" to just "npm". That's like saying "ATM machine"

Heh heh. Maybe not...


### The Gist

Expand Down