Skip to content

Include Tip about computed env vars #1780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 10, 2018
Merged

Include Tip about computed env vars #1780

merged 7 commits into from
Jul 10, 2018

Conversation

FossPrime
Copy link
Contributor

@FossPrime FossPrime commented Jul 6, 2018

I'm personally using this frivolously in my own footer

// vue.config.js
const revision = require('child_process').execSync('git rev-parse HEAD').toString().trim()
const pjson = require('./package.json')

process.env.VUE_APP_COMMIT = `${revision}`
process.env.VUE_APP_VERSION = `${pjson.version}`
module.exports = {}
<template>
  <footer>
      <span>v{{ version }} ({{ commit }})</span>
  </footer>
</template>

<script>
export default {
  data: function () {
    return {
      version: process.env.VUE_APP_VERSION,
      commit: process.env.VUE_APP_COMMIT
    }
  }
}

Validation

  • I'm using this.
  • The inline require doesn't cause lint issues on vue-cli v3 config files. I did a full build to check.

Ray Foss added 4 commits July 6, 2018 12:26
I'm personally using this frivolously in my own footer
```
// vue.config.js
const revision = require('child_process').execSync('git rev-parse HEAD').toString().trim()
const pjson = require('./package.json')

process.env.VUE_APP_COMMIT = `"${revision}"`
process.env.VUE_APP_VERSION = `"${pjson.version}"`
module.exports = {}
```

```
<template>
  <footer>
      <span>v{{ version }} ({{ commit }})</span>
  </footer>
</template>

<script>
export default {
  data: function () {
    return {
      version: process.env.VUE_APP_VERSION,
      commit: process.env.VUE_APP_COMMIT
    }
  }
}
```

# Validation
 - I'm using this.
 - The inline require doesn't cause lint issues on vue-cli v3 config files. I did a full builds to check.
@Akryum Akryum merged commit 62e2868 into vuejs:dev Jul 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants