Skip to content

Commit d4bd9c6

Browse files
gregoiredxNataliaTepluhina
authored andcommitted
use gitlab CI env variable for project name (#4716)
* use gitlab CI env variable for project name * add explanation on CI_PROJECT_NAME env var * docs: gzip support in GitLab Pages
1 parent 77384ec commit d4bd9c6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/guide/deployment.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,24 @@ pages: # the job must be named pages
130130
- npm run build
131131
- mv public public-vue # GitLab Pages hooks on the public folder
132132
- mv dist public # rename the dist folder (result of npm run build)
133+
# optionally, you can activate gzip support wih the following line:
134+
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
133135
artifacts:
134136
paths:
135137
- public # artifact path must be /public for GitLab Pages to pick it up
136138
only:
137139
- master
138140
```
139141

140-
Typically, your static website will be hosted on https://yourUserName.gitlab.io/yourProjectName, so you will also want to create an initial `vue.config.js` file to [update the `BASE_URL`](https://github.com/vuejs/vue-cli/tree/dev/docs/config#baseurl) value to match:
142+
Typically, your static website will be hosted on https://yourUserName.gitlab.io/yourProjectName, so you will also want to create an initial `vue.config.js` file to [update the `BASE_URL`](https://github.com/vuejs/vue-cli/tree/dev/docs/config#baseurl) value to match your project name (the [`CI_PROJECT_NAME` environment variable](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) contains this value):
143+
141144

142145
```javascript
143146
// vue.config.js file to be place in the root of your repository
144-
// make sure you update `yourProjectName` with the name of your GitLab project
145147
146148
module.exports = {
147149
publicPath: process.env.NODE_ENV === 'production'
148-
? '/yourProjectName/'
150+
? '/' + process.env.CI_PROJECT_NAME + '/'
149151
: '/'
150152
}
151153
```

0 commit comments

Comments
 (0)