quasar-framework.org icon indicating copy to clipboard operation
quasar-framework.org copied to clipboard

Request to Restore DEV vs PROD Documentation Page

Open altShiftDev opened this issue 7 years ago • 0 comments

Quasar: v0.15.6 Browsers: Any Any other software related to your bug:

What did you get as the error?

No error, this is a request to bring back the DEV vs Prod documentation page found on old quasar releases (http://v0-14.quasar-framework.org/guide/app-dev-vs-production-code.html)

What were you expecting?

I find this page is very useful and there's an easy workaround for adapting the if (DEV) statement into v0.15.8 and wanted to share it with the community:

Old method:

someFunction() {
    if (DEV) {
      console.log('DEV!)
    }
    // Alternatively: if (PROD) ...
}

New method:

someFunction() {
    if (process.env.DEV) {
      console.log('DEV!)
    }
    // Alternatively: if (process.env.PROD) ...
}

You can also use this flag in the <template> area with v-if/v-show by binding it to a variable in your data property:

<template>
      <div>
          <span v-if="isDev">This is the DEV environment</span>
          <span v-if="!isDev">This is the PROD environment</span>
      </div>
</template>

export default {
  data () {
    return {
      isDev: process.env.DEV
    }
  }
}

altShiftDev avatar Mar 21 '18 17:03 altShiftDev