0.0.2 • Published 3 years ago

resolvenv v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

resolvenv

A tool for static site applications that switches variables by deployment environment.

Install

$ npm install resolvenv --save

How to use

This is a sample code of Vue.js app.

<template>
  <h1>Sample</h1>
  <h2>{{ envParameter }}</h2>
</template>

<script>
import { resolvenv, hostname } from "resolvenv";

export default {
  name: "App",
  data() {
    return {
      envParameter: null,
    };
  },
  mounted() {
    const envParams = [
      { env: hostname("localhost"), value: "this-is-localhost" },
      { env: hostname("dev-environment"), value: "this-is-dev-environment" },
      { env: hostname("prod-environment"), value: "this-is-prod-environment" },
    ];
    this.envParameter = resolvenv(envParams);
  },
};
</script>

sample-image