Skip to content

Commit 8eae0d7

Browse files
committed
chore: merge branch 'docs' into v3
2 parents ad0882d + 7e6de2a commit 8eae0d7

File tree

3 files changed

+28
-58
lines changed

3 files changed

+28
-58
lines changed

docs/config/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ See [the plugin's README](https://github.com/vuejs/vue-cli/blob/dev/packages/%40
266266
When building as a library, you can also set this to `false` to avoid your users having to import the CSS themselves.
267267

268268
Extracting CSS is disabled by default in development mode since it is incompatible with CSS hot reloading. However, you can still enforce extraction in all cases by explicitly setting the value to `true`.
269+
270+
Instead of a `true`, you can also pass an object of options for the [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) if you want to further configure what this plugin does exactly.
269271

270272
### css.sourceMap
271273

docs/guide/deployment.md

Lines changed: 17 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -263,75 +263,35 @@ You can now access your project on `https://<YOUR-PROJECT-ID>.firebaseapp.com`.
263263

264264
Please refer to the [Firebase Documentation](https://firebase.google.com/docs/hosting/deploying) for more details.
265265

266-
### Now
266+
### ZEIT Now
267267

268-
This example uses the latest Now platform version 2.
268+
[ZEIT Now](https://zeit.co) is a cloud platform for websites and serverless APIs, that you can use to deploy your Vue projects to your personal domain (or a free `.now.sh` suffixed URL).
269269

270-
1. Install the Now CLI globally:
270+
This guide will show you how to get started in a few quick steps:
271+
272+
#### Step 1: Installing Now CLI
273+
274+
To install their command-line interface with [npm](https://www.npmjs.com/package/now), run the following command:
271275

272276
```bash
273277
npm install -g now
274278
```
275279

276-
2. Add a `now.json` file to your project root:
277-
278-
```json
279-
{
280-
"name": "my-example-app",
281-
"version": 2,
282-
"builds": [
283-
{ "src": "dist/**", "use": "@now/static" }
284-
],
285-
"routes": [
286-
{ "src": "/(.*)", "dest": "dist/$1" }
287-
],
288-
"alias": "vue-example"
289-
}
290-
```
291-
292-
In case you want to deploy an application with router mode set to history, the config file should look like the following (if you have different folder names, update your config accordingly):
293-
```json
294-
{
295-
"name": "my-example-app",
296-
"version": 2,
297-
"builds": [
298-
{
299-
"src": "dist/**",
300-
"use": "@now/static"
301-
}
302-
],
303-
"routes": [
304-
{
305-
"src": "/(js|css|img)/(.*)",
306-
"dest": "/dist/$1/$2"
307-
},
308-
{
309-
"src": "/favicon.ico",
310-
"dest": "/dist/favicon.ico"
311-
},
312-
{
313-
"src": "/(.*)",
314-
"dest": "/dist"
315-
}
316-
],
317-
"alias": "vue-example"
318-
}
319-
```
320-
This additional config is required in order to avoid issues when directly deep-linking to a specific page (e.g. when opening `my-example-app.now.sh/some-subpage`, you would be presented with a 404 error otherwise).
280+
#### Step 2: Deploying
321281

322-
3. Adding a deployment script in `package.json`:
282+
You can deploy your application by running the following command in the root of the project directory:
323283

324-
```json
325-
"deploy": "npm run build && now --target production"
326-
```
284+
```bash
285+
now
286+
```
327287

328-
If you want to deploy publicly by default, you can change the deployment script to the following one:
288+
**Alternatively**, you can also use their integration for [GitHub](https://zeit.co/github) or [GitLab](https://zeit.co/gitlab).
329289

330-
```json
331-
"deploy": "npm run build && now --target production --public"
332-
```
290+
That’s all!
291+
292+
Your site will deploy, and you will receive a link similar to the following: https://vue.now-examples.now.sh
333293

334-
This will automatically point your site's alias to the latest deployment. Now, just run `npm run deploy` to deploy your app.
294+
Out of the box, you are already provided with the necessary routes for rewriting requests (except for custom static files) directly to your `index.html` file and the appropiate default caching headers. This behaviour can be overwritten [like this](https://zeit.co/docs/v2/advanced/routes/).
335295

336296
### Stdlib
337297

docs/zh/guide/css.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Vue CLI 项目天生支持 [PostCSS](http://postcss.org/)、[CSS Modules](https:
1212

1313
``` bash
1414
# Sass
15-
npm install -D sass-loader node-sass
15+
npm install -D sass-loader sass
1616

1717
# Less
1818
npm install -D less-loader less
@@ -29,6 +29,14 @@ $color: red;
2929
</style>
3030
```
3131

32+
::: tip Sass 性能贴士
33+
请注意,当使用 Dart 版本的 Sass 时,默认情况下,**同步编译的速度为异步编译速度的两倍**,这是由于异步回调造成的性能开销。为避免此开销,你可以使用 [fibers](https://www.npmjs.com/package/fibers) 的 package 在异步环境下使用同步的代码。要启用此功能,只需安装 `fibers` 到项目依赖:
34+
```
35+
npm install -D fibers
36+
```
37+
另外请注意,由于这是一个原生模块,因此 OS 与构建环境之间可能存在兼容问题。如果遇到此问题,请执行 `npm uninstall -D fibers` 来解决此问题。
38+
:::
39+
3240
### 自动化导入
3341

3442
如果你想自动化导入文件 (用于颜色、变量、mixin……),你可以使用 [style-resources-loader](https://github.com/yenshih/style-resources-loader)。这里有一个关于 Stylus 的在每个单文件组件和 Stylus 文件中导入 `./src/styles/imports.styl` 的例子:

0 commit comments

Comments
 (0)