Using build variable in a Vue.js project?

Good day, hope you’re all doing well. I have in my .gitlab-ci.yml file a variable called APP_NAME that I’d like to use in my Vue.js app. This is what I’m thinking so far:

.gitlab-ci.yml:

variables:
	APP_NAME="My First Vue.js Application"
app.vue:

onMounted(async () => {
    console.log(APP_NAME)
})

Any tips or ideas how to go about doing this? The docs are pretty slim on this info, thanks so much!

Are you looking at getting data from some variable defined in your build pipeline, and then using that when you run you Vue app?
If so, maybe you look at writing out a file with that variable in during your build pipeline, and then package it up with your app. Your app can then reference that when it runs.

Cheers,

Matt

1 Like