This document provides instructions for how to add environment specific modifications to the Web UI.
.env.<ENV_NAME>
file in the project rootNODE_ENV=production
key value pair in the fileVUE_APP_ENV_NAME
key with the value set to the new environment nameExample .env.ibm
:
NODE_ENV=production VUE_APP_ENV_NAME=ibm
Vuex store modules contain the application's API calls.
CUSTOM_STORE=true
key value pair to the new .env file.<ENV_NAME>.js
file in src/env/store
The filename needs to match the
VUE_APP_ENV_NAME
value defined in the .env file. The store import insrc/main.js
will resolve to this new file.
registerModule
and unregisterModule
instance methods to add/remove store modulesExample src/env/store/ibm.js
:
import store from '@/store; //@ aliases to src directory import HmcStore from './Hmc/HmcStore'; store.registerModule('hmc', HmcStore); export default store;
Vue Router determines which pages are accessible in the UI.
CUSTOM_ROUTER=true
key value pair to the new .env file.<ENV_NAME>.js
file in src/env/router
The filename needs to match the
VUE_APP_ENV_NAME
value defined in the .env file. The routes import insrc/router/index.js
will resolve to this new file.
Use static imports (over lazy-loading routes) to avoid creating separate JS chunks. Static imports also helps to keep the total build size down.
The Vue Router definition is closely tied to the app navigation but should be configured separately. The Vue Router is responsible for defining the application routes which is not always the same as what is visible in the app navigation. This configuration will make customizations to the rendered markup in src/components/AppNavigation/AppNavigation.vue.
CUSTOM_APP_NAV=true
key value pair to the new .env file.<ENV_NAME>.js
file in src/env/components/AppNavigation
The filename needs to match the
VUE_APP_ENV_NAME
value defined in the .env file. The AppNavigationMixin import insrc/components/AppNavigation/AppNavigation.vue
will resolve to this new file.
navigationItems
that should be an array of of navigation objects. Each navigation object should have an id
and label
property defined. Optionally it can include icon
, route
, or children
properties.Bootstrap theming allows for easy visual customizations.
CUSTOM_STYLES=true
key value pair to the new .env file._<ENV_NAME>.scss
partial in src/env/assets/styles
The filename needs to match the
VUE_APP_ENV_NAME
value defined in the .env file. The webpack sass loader will attempt to import a file with this name.
Example for adding custom colors
src/env/assets/styles/_ibm.scss
// Custom theme colors $primary: rebeccapurple; $success: lime;
VUE_APP_ENV_NAME
key value pair to your env.development.local
file.npm run serve
Run npm build script with vue-cli --mode
option flag. This requires corresponding .env file to exist.
npm run build -- --mode ibm
OR
pass env variable directly to script
VUE_APP_ENV_NAME=ibm npm run build