Skip to content

Commit

Permalink
fix image syntax example (close vuejs#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 14, 2018
1 parent adcbeb1 commit 809927b
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions docs/guide/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,30 @@
All markdown files are compiled into Vue components and processed by webpack, therefore you can and **should prefer** referencing any asset using relative URLs:

``` md
![An image][./image.png]
![An image](./image.png)
```

This would work the same way as in `*.vue` file templates. The image will be processed with `url-loader` and `file-loader`, and copied to appropriate locations in the generated static build.

In addition, you can use the `~` prefix to explicitly indicate this is a webpack module request, allowing you to reference files with webpack aliases or from npm dependencies:

``` md
![Image from alias][~@assets/image.png]
![Image from dependency][~some-dependency/image.png]
![Image from alias](~@alias/image.png)
![Image from dependency](~some-dependency/image.png)
```

webpack aliases can be configured via [configureWebpack](/config/#configurewebpack) in `.vuepress/config.js`. Example:

``` js
module.exports = {
configurewebpack: {
resolve: {
alias: {
'@alias': 'path/to/some/dir'
}
}
}
}
```

## Public Files
Expand Down

0 comments on commit 809927b

Please sign in to comment.