File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 19
19
20
20
<script >
21
21
import imageAsset from ' docc-render/mixins/imageAsset' ;
22
- import { normalizeAssetUrl } from ' docc-render/utils/assets' ;
23
-
24
- const toCSSUrl = url => (url ? ` url('${ normalizeAssetUrl (url)} ')` : undefined );
22
+ import { toCSSUrl } from ' docc-render/utils/assets' ;
25
23
26
24
export default {
27
25
name: ' CardCover' ,
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ import LinkableElement from 'docc-render/components/LinkableElement.vue';
73
73
74
74
import GenericModal from ' docc-render/components/GenericModal.vue' ;
75
75
import PlayIcon from ' theme/components/Icons/PlayIcon.vue' ;
76
- import { normalizeAssetUrl } from ' docc-render/utils/assets' ;
76
+ import { normalizeAssetUrl , toCSSUrl } from ' docc-render/utils/assets' ;
77
77
import HeroMetadata from ' ./HeroMetadata.vue' ;
78
78
79
79
export default {
@@ -140,14 +140,14 @@ export default {
140
140
variant .traits .includes (' light' )
141
141
));
142
142
143
- return lightVariant ? normalizeAssetUrl ( lightVariant .url ) : ' ' ;
143
+ return ( lightVariant || {}) .url ;
144
144
},
145
145
projectFilesUrl () {
146
146
return this .projectFiles ? normalizeAssetUrl (this .references [this .projectFiles ].url ) : null ;
147
147
},
148
148
bgStyle () {
149
149
return {
150
- backgroundImage: ` url(' ${ this .backgroundImageUrl } ') ` ,
150
+ backgroundImage: toCSSUrl ( this .backgroundImageUrl ) ,
151
151
};
152
152
},
153
153
xcodeRequirementData () {
Original file line number Diff line number Diff line change @@ -75,3 +75,10 @@ export function normalizeAssetUrl(url) {
75
75
}
76
76
return pathJoin ( [ baseUrl , url ] ) ;
77
77
}
78
+
79
+ /**
80
+ * Transforms a URL string into a normalized css `url(/path)` format.
81
+ * @param {String } url
82
+ * @returns {string|undefined }
83
+ */
84
+ export function toCSSUrl ( url ) { return url ? `url('${ normalizeAssetUrl ( url ) } ')` : undefined ; }
You can’t perform that action at this time.
0 commit comments