From f7c187eec98f3e58a9c6959490d0cd8c58d932cf Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Thu, 24 Nov 2016 20:46:49 -0500 Subject: [PATCH] improve installation docs --- docs/installation.md | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/docs/installation.md b/docs/installation.md index 51c0848e..07e69cae 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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): + +``` + +``` + +--- + ### 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: