I encounter an issue that seems rather common. Sometimes in my quasar application, I utilize the vite/quasar shortcut for assets like the example below:
<q-carousel-slide :name="2" class="column no-wrap flex-center q-pa-none">
<q-img src="~assets/imgs/carousel/service-upgrade.jpg" style="height:100%">
<div class="column no-wrap flex-center" style="width: 100%;height:100%">
<q-img src="~assets/imgs/carousel/logo-white.png" style="max-width:250px" class="q-mb-lg"></q-img>
<h1 class="text-h1 text-weight-bolder text-white q-my-none">
ELECTRICAL UPGRADES
</h1>
<h4 class="text-h4 text-weight-light q-mt-xs q-mb-lg text-white">
NEW WIRING & SERVICE UPGRADES
</h4>
<q-btn outline color="white" class="q-my-5 my-btn" label="GET A QUOTE" size="lg" @click="layoutStore.toggleContactUsDrawer"/>
</div>
</q-img>
</q-carousel-slide>
However, there are instances where it is more convenient to use an array to shorten my code with a v-for loop like the following:
<q-tab-panel name="lighting">
<div class="row q-pa-md block-wrapper text-center q-col-gutter-md" style="margin-bottom:100px;">
<div v-for="item in imagesArray[0]['lighting']" :key="item.id" class="col-sm-4 col-xs-6">
<q-img loading="eager" :src="getImageUrl(item.link)" class="rounded-borders text-right" :ratio="16/9" @click="openFullScreenImage(getImageUrl(item.link))"/>
</div>
</div>
</q-tab-panel>
Here is the script with relative paths for the code above:
const imagesArray = [{
panels:[
{ id: 1, link: '../assets/imgs/recentwork/panels/panel 1.jpg'},
{ id: 2, link: '../assets/imgs/recentwork/panels/panel 2.jpg'},
{ id: 3, link: '../assets/imgs/recentwork/panels/panel 3.jpg'},
{ id: 4, link: '../assets/imgs/recentwork/panels/panel 4.jpg'},
{ id: 5, link: '../assets/imgs/recentwork/panels/panel 5.jpg'},
{ id: 6, link: '../assets/imgs/recentwork/panels/panel 6.jpg'},
{ id: 7, link: '../assets/imgs/recentwork/panels/panel 7.jpg'},],
lighting: [
{ id: 1, link: '../assets/imgs/recentwork/lighting/lighting 13.jpg'},
{ id: 2, link: '../assets/imgs/recentwork/lighting/lighting 22.jpg'},
{ id: 3, link: '../assets/imgs/recentwork/lighting/lighting 26.jpg'},
{ id: 4, link: '../assets/imgs/recentwork/lighting/lighting 24.jpg'},
{ id: 5, link: '../assets/imgs/recentwork/lighting/lighting 28.jpg'},
{ id: 6, link: '../assets/imgs/recentwork/lighting/lighting 17.jpg'},
{ id: 7, link: '../assets/imgs/recentwork/lighting/lighting 27.jpg'},
{ id: 8, link: '../assets/imgs/recentwork/lighting/lighting 30.jpg'},
{ id: 9, link: '../assets/imgs/recentwork/lighting/lighting 12.jpg'},
],
commercial: [
{ id: 1, link: '../assets/imgs/recentwork/commercial/commercial 1.jpg'},
{ id: 2, link: '../assets/imgs/recentwork/commercial/commercial 2.jpg'},
{ id: 3, link: '../assets/imgs/recentwork/commercial/commercial 3.jpg'},
{ id: 4, link: '../assets/imgs/recentwork/commercial/commercial 4.jpg'},
{ id: 5, link: '../assets/imgs/recentwork/commercial/commercial 5.jpg'},
{ id: 6, link: '../assets/imgs/recentwork/commercial/commercial 6.jpg'},
{ id: 7, link: '../assets/imgs/recentwork/commercial/commercial 7.jpg'},
{ id: 8, link: '../assets/imgs/recentwork/commercial/commercial 8.jpg'},
{ id: 9, link: '../assets/imgs/recentwork/commercial/commercial 9.jpg'},
],
However, maintaining two sets of image folders, one in the src folder and another in the public/assets/imgs folder, becomes a tedious task. It is cumbersome to keep copying the images back and forth, and it becomes even more challenging to update them separately.
Is there a way to utilize the src assets img folder exclusively instead of relying on the public folder, which is quite cumbersome to manage?