Skip to content

Commit

Permalink
[Update] img src
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieVerdurme committed Aug 10, 2021
1 parent 7cf2088 commit eb107b6
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
12 changes: 12 additions & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,20 @@ const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
} : {}

export default {

...routerBase,
/*
** Setup process.env variable
*/
env: {
imgPrefix: process.env.DEPLOY_ENV === 'GH_PAGES' ? '' : '/'
},

/**
** Setup webpage mode
*/
mode: 'universal',

/*
** Headers of the page
*/
Expand Down
2 changes: 1 addition & 1 deletion pages/contact/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
},
data () {
return {
header: 'img/background.jpg',
header: process.env.imgPrefix + 'img/background.jpg',
name: null,
email: null,
message: null
Expand Down
2 changes: 1 addition & 1 deletion pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default {
},
data () {
return {
header: 'img/background.jpg'
header: process.env.imgPrefix + 'img/background.jpg'
}
},
computed: {
Expand Down
4 changes: 2 additions & 2 deletions pages/profile/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export default {
data () {
return {
// images
header: 'img/background.jpg',
img: 'img/faces/ProfilePic.jpg',
header: process.env.imgPrefix + 'img/background.jpg',
img: process.env.imgPrefix + 'img/faces/ProfilePic.jpg',
// project data
projects: this.$t('profile.projects').slice(0, 2)
Expand Down
9 changes: 7 additions & 2 deletions pages/projects/_name.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

<!--photo's-->
<template slot="tab-pane-2">
<img v-for="img in project.img" :key="img" :src="img" class="project-img" :alt="project.name">
<img v-for="img in project.img" :key="img" :src="getImgSrc(img)" class="project-img" :alt="project.name">
</template>
<!--/photo's-->
</tabs>
Expand All @@ -86,7 +86,7 @@ export default {
data () {
return {
name: this.$route.params.name,
header: 'img/background.jpg'
header: process.env.imgPrefix + 'img/background.jpg'
}
},
computed: {
Expand All @@ -104,6 +104,11 @@ export default {
project () {
return this.$t('profile.projects').find(p => p.name === this.name)
}
},
methods: {
getImgSrc (imgSrc) {
return process.env.imgPrefix + imgSrc
}
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion pages/projects/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
currentPage: null,
projects: this.$t('profile.projects'),
filterdItems: [],
header: 'img/background.jpg'
header: process.env.imgPrefix + 'img/background.jpg'
}
},
computed: {
Expand Down

0 comments on commit eb107b6

Please sign in to comment.