Commit Graph

5 Commits

Author SHA1 Message Date
Evan You 45cc5e94e9 docs: add tip about env loading priorities 2018-07-23 12:34:49 -04:00
Guillaume Chau 33b852f7a8 docs: fix tip [ci skip] 2018-07-12 00:36:17 +02:00
Ray Foss 62e2868007 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, yet
2018-07-11 01:28:04 +02:00
Evan You fb97646ee5 docs: more content 2018-06-08 00:10:35 -04:00
Evan You 4e922055e4 docs: wip 2018-06-05 14:50:04 -04:00