|
1 | 1 | # Getting Started
|
2 | 2 |
|
3 |
| -::: warning COMPATIBILITY NOTE |
4 |
| -VuePress requires Node.js >= 8. |
| 3 | +::: warning Prerequisite |
| 4 | +VuePress requires [Node.js](https://nodejs.org/en/) >= 8.6. |
5 | 5 | :::
|
6 | 6 |
|
7 |
| -## Global Installation |
| 7 | +This section will help you build a basic VuePress documentation site from ground up. If you already have an existing project and would like to keep documentation inside the project, start from Step 3. |
8 | 8 |
|
9 |
| -If you only want to play around with VuePress, you can install it globally: |
| 9 | +1. Create and change into a new directory |
10 | 10 |
|
11 |
| -``` bash |
12 |
| -# install globally |
13 |
| -yarn global add vuepress # OR npm install -g vuepress |
| 11 | + ``` bash |
| 12 | + mkdir vuepress-starter && cd vuepress-starter |
| 13 | + ``` |
14 | 14 |
|
15 |
| -# create the project folder |
16 |
| -mkdir vuepress-starter && cd vuepress-starter |
| 15 | +2. Initialize with your preferred package manager |
17 | 16 |
|
18 |
| -# create a markdown file |
19 |
| -echo '# Hello VuePress' > README.md |
| 17 | + ``` bash |
| 18 | + yarn init # npm init |
| 19 | + ``` |
20 | 20 |
|
21 |
| -# start writing |
22 |
| -vuepress dev |
| 21 | +3. Install VuePress locally |
23 | 22 |
|
24 |
| -# build |
25 |
| -vuepress build |
26 |
| -``` |
| 23 | + Globally installed VuePress is no longer recommended. |
27 | 24 |
|
28 |
| -## Inside an Existing Project |
| 25 | + ``` bash |
| 26 | + yarn add -D vuepress # npm install -D vuepress |
| 27 | + ``` |
29 | 28 |
|
30 |
| -If you have an existing project and would like to keep documentation inside the project, you should install VuePress as a local dependency. This setup also allows you to use CI or services like [Netlify](https://netlify.com) for automatic deployment on push. |
| 29 | + ::: warning |
| 30 | + We currently recommend using [Yarn](https://classic.yarnpkg.com/lang/en/) instead of npm when installing VuePress into an existing project that has webpack 3.x as a dependency, because npm fails to generate the correct dependency tree in this case. |
| 31 | + ::: |
31 | 32 |
|
32 |
| -``` bash |
33 |
| -# install as a local dependency |
34 |
| -yarn add -D vuepress # OR npm install -D vuepress |
| 33 | +4. Create your first document |
35 | 34 |
|
36 |
| -# create a docs directory |
37 |
| -mkdir docs |
38 |
| -# create a markdown file |
39 |
| -echo '# Hello VuePress' > docs/README.md |
40 |
| -``` |
| 35 | + ``` bash |
| 36 | + mkdir docs && echo '# Hello VuePress' > docs/README.md |
| 37 | + ``` |
41 | 38 |
|
42 |
| -::: warning |
43 |
| -We currently recommend using [Yarn](https://yarnpkg.com/en/) instead of npm when installing VuePress into an existing project that has webpack 3.x as a dependency, because npm fails to generate the correct dependency tree in this case. |
44 |
| -::: |
| 39 | +5. Add some [scripts](https://classic.yarnpkg.com/en/docs/package-json#toc-scripts) to `package.json` |
| 40 | + |
| 41 | + This step is optional but highly recommended, the rest of the documentaion will assume those scripts being added. |
45 | 42 |
|
46 |
| -Then, add some scripts to `package.json`: |
| 43 | + ``` json |
| 44 | + { |
| 45 | + "scripts": { |
| 46 | + "docs:dev": "vuepress dev docs", |
| 47 | + "docs:build": "vuepress build docs" |
| 48 | + } |
| 49 | + } |
| 50 | + ``` |
47 | 51 |
|
48 |
| -``` json |
49 |
| -{ |
50 |
| - "scripts": { |
51 |
| - "docs:dev": "vuepress dev docs", |
52 |
| - "docs:build": "vuepress build docs" |
53 |
| - } |
54 |
| -} |
55 |
| -``` |
| 52 | +6. Serve the documentation site in the local server |
56 | 53 |
|
57 |
| -You can now start writing with: |
| 54 | + ``` bash |
| 55 | + yarn docs:dev # npm run docs:dev |
| 56 | + ``` |
58 | 57 |
|
59 |
| -``` bash |
60 |
| -yarn docs:dev # OR npm run docs:dev |
61 |
| -``` |
| 58 | + VuePress will start a hot-reloading development server at [http://localhost:8080](http://localhost:8080). |
62 | 59 |
|
63 |
| -To generate static assets, run: |
| 60 | +By now, you should have a basic but functional VuePress documentation site. Next, learn about VuePress’ recommended [directory structure](directory-structure.html) and the basics of [configuration](basic-config.html) in VuePress. |
64 | 61 |
|
65 |
| -``` bash |
66 |
| -yarn docs:build # OR npm run docs:build |
67 |
| -``` |
| 62 | +Once you’re familiar with those concepts mentioned above, learn about how to enrich your content with [static assests](assets.html), [Markdown extensions](markdown.html) and [vue components](using-vue.html). |
68 | 63 |
|
69 |
| -By default, the built files will be in `.vuepress/dist`, which can be configured via the `dest` field in `.vuepress/config.js`. The built files can be deployed to any static file server. See [Deployment Guide](deploy.md) for guides on deploying to popular services. |
| 64 | +And when your documentation site start to take shape, check out the [multi-language support](i18n.html) and guides for [deploying](deploy.html) your site to popular services. |
0 commit comments