Skip to content

Commit

Permalink
use gitlab CI env variable for project name (#4716)
Browse files Browse the repository at this point in the history
* use gitlab CI env variable for project name

* add explanation on CI_PROJECT_NAME env var

* docs: gzip support in GitLab Pages
  • Loading branch information
gregoiredx authored and NataliaTepluhina committed Nov 7, 2019
1 parent 77384ec commit d4bd9c6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/guide/deployment.md
Expand Up @@ -130,22 +130,24 @@ pages: # the job must be named pages
- npm run build
- mv public public-vue # GitLab Pages hooks on the public folder
- mv dist public # rename the dist folder (result of npm run build)
# optionally, you can activate gzip support wih the following line:
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
artifacts:
paths:
- public # artifact path must be /public for GitLab Pages to pick it up
only:
- master
```

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:
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):


```javascript
// vue.config.js file to be place in the root of your repository
// make sure you update `yourProjectName` with the name of your GitLab project

module.exports = {
publicPath: process.env.NODE_ENV === 'production'
? '/yourProjectName/'
? '/' + process.env.CI_PROJECT_NAME + '/'
: '/'
}
```
Expand Down

0 comments on commit d4bd9c6

Please sign in to comment.