Skip to content

Commit 449a712

Browse files
postalservice14pi0
authored andcommitted
fix(docs): vue-loader v15 changes (#2005)
1 parent 9e0eb67 commit 449a712

File tree

1 file changed

+27
-21
lines changed

1 file changed

+27
-21
lines changed

docs/markdown/reference/images/README.md

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
11
# Project relative image URLs for Bootstrap Vue custom components
22

33
> vue-loader automatically converts project relative `src` attributes
4-
on `<img>` tags, but doesn't automatically for Bootrap-Vue custom
4+
on `<img>` tags, but doesn't automatically for Bootstrap-Vue custom
55
components that accept image src url tags.
66

7-
## Vue-loader `transformToRequire` to resolve img paths
7+
## Vue-loader `transformAssetUrls` to resolve img paths
88
To have your project convert these custom component image URLs for you, you will need to
9-
customize the [`transformToRequire`](https://vue-loader.vuejs.org/en/options.html#transformtorequire)
9+
customize the [`transformAssetUrls`](https://vue-loader.vuejs.org/options.html#transformasseturls)
1010
`option` for `vue-loader` in your webpack config.
1111

12-
The default value for `transformToRequire` is:
12+
The default value for `transformAssetUrls` is:
1313

1414
```js
15-
transformToRequire: {
16-
'img': 'src',
17-
'image': 'xlink:href'
15+
transformAssetUrls: {
16+
video: ['src', 'poster'],
17+
source: 'src',
18+
img: 'src',
19+
image: 'xlink:href'
1820
}
1921
```
2022

2123
To allow Bootstrap-Vue components to use project relative URLs,
2224
use the following configuration:
2325

2426
```js
25-
transformToRequire: {
26-
'img': 'src',
27-
'image': 'xlink:href',
28-
'b-img': 'src',
29-
'b-img-lazy': ['src', 'blank-src'],
30-
'b-card': 'img-src',
31-
'b-card-img': 'img-src',
32-
'b-carousel-slide': 'img-src',
33-
'b-embed': 'src'
27+
transformAssetUrls: {
28+
video: ['src', 'poster'],
29+
source: 'src',
30+
img: 'src',
31+
image: 'xlink:href',
32+
'b-img': 'src',
33+
'b-img-lazy': ['src', 'blank-src'],
34+
'b-card': 'img-src',
35+
'b-card-img': 'img-src',
36+
'b-carousel-slide': 'img-src',
37+
'b-embed': 'src'
3438
}
3539
```
3640

@@ -42,17 +46,19 @@ This will allow you to use the following format in your `.vue` files:
4246
<b-card-img img-src="~/static/picture.jpg" />
4347
```
4448

45-
### Configuring `transformToRequire` in Nuxt
49+
### Configuring `transformAssetUrls` in Nuxt
4650

4751
In your `nuxt.config.js` file, add the following to your build section:
4852

4953
```js
5054
build: {
5155
extend (config, ctx) {
5256
const vueLoader = config.module.rules.find((rule) => rule.loader === 'vue-loader')
53-
vueLoader.options.transformToRequire = {
54-
'img': 'src',
55-
'image': 'xlink:href',
57+
vueLoader.options.transformAssetUrls = {
58+
video: ['src', 'poster'],
59+
source: 'src',
60+
img: 'src',
61+
image: 'xlink:href',
5662
'b-img': 'src',
5763
'b-img-lazy': ['src', 'blank-src'],
5864
'b-card': 'img-src',
@@ -65,7 +71,7 @@ build: {
6571
```
6672

6773
## Using `require` to resolve image paths
68-
If you cannot set the `transforToRequire` in your view-loader config, you
74+
If you cannot set the `transformAssetUrls` in your view-loader config, you
6975
can alternatively use the `require` method:
7076

7177
```html

0 commit comments

Comments
 (0)