Commit 62e2868
docs: Include Tip about computed env vars (#1780)
* Include tip about computed env vars
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.
* tip format match
* tip format
* tip, format
* markdown formatting conflicts with es6 templates
Also, quotes, optional now. interesting. I tried it.
* remove template stray
* filenames are not proper english grammar, yet1 parent 78174dc commit 62e2868
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
| |||
0 commit comments