improve installation docs
This commit is contained in:
parent
94804356fe
commit
f7c187eec9
1 changed files with 27 additions and 7 deletions
|
|
@ -1,32 +1,52 @@
|
|||
# Installation
|
||||
|
||||
### CDN
|
||||
|
||||
If you're new to Javascript or just want a very simple setup to get your feet wet, you can get Mithril from a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network):
|
||||
|
||||
```
|
||||
<script src="http://cdn.rawgit.com/lhorie/mithril.js/rewrite/mithril.js"></script>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### NPM
|
||||
|
||||
#### Quick start
|
||||
|
||||
```
|
||||
#install
|
||||
# 1) install
|
||||
npm install mithril@rewrite --save
|
||||
|
||||
# add this line into the scripts section in package.json
|
||||
# 2) add this line into the scripts section in package.json
|
||||
# "scripts": {
|
||||
# "build": "bundle index.js --output app.js --watch"
|
||||
# }
|
||||
|
||||
# create an `index.js` file
|
||||
# 3) create an `index.js` file
|
||||
|
||||
# run bundler
|
||||
# 4) run bundler
|
||||
npm run build
|
||||
```
|
||||
|
||||
#### Step by step
|
||||
|
||||
For production-level projects, the recommended way of installing Mithril is to use NPM.
|
||||
|
||||
NPM (Node package manager) is the default package manager that is bundled w/ Node.js. It is widely used as the package manager for both client-side and server-side libraries in the Javascript ecosystem. Download and install [Node.js](https://nodejs.org); NPM will be automatically installed as well.
|
||||
|
||||
To use Mithril via NPM:
|
||||
To use Mithril via NPM, go to your project folder, and run `npm init --yes` from the command line. This will create a file called `package.json`.
|
||||
|
||||
- go to your project folder, and run `npm init --yes` from the command line. This will create a file called `package.json`.
|
||||
- run `npm install mithril@rewrite --save`. This will create a folder called `node_modules`, and a `mithril` folder inside of it. It will also add an entry under `dependencies` in the `package.json` file
|
||||
```
|
||||
npm init --yes
|
||||
# creates a file called package.json
|
||||
```
|
||||
|
||||
Then, run `npm install mithril@rewrite --save` to install Mithril. This will create a folder called `node_modules`, and a `mithril` folder inside of it. It will also add an entry under `dependencies` in the `package.json` file
|
||||
|
||||
```
|
||||
npm install mithril@rewrite --save
|
||||
```
|
||||
|
||||
You are now ready to start using Mithril. The recommended way to structure code is to modularize it via CommonJS modules:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue