summaryrefslogtreecommitdiff
path: root/vue.config.js
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-07-09 02:15:46 +0300
committerDerick Montague <derick.montague@ibm.com>2020-07-27 16:38:28 +0300
commitd388a28b478bf0224e37e292f8bc30fabe2c7059 (patch)
treece816f9b249b1eb6ebcf6448d18752f12cbaf9de /vue.config.js
parent6534e58bc4c46165d846f786804f534aab29912d (diff)
downloadwebui-vue-d388a28b478bf0224e37e292f8bc30fabe2c7059.tar.xz
Add ability to customize theme styles
Showcases how different themes/styles can be supported using .env variables. If an environemnt name is specified during the build process, an overrides file will be pulled in to allow modifications to color and font definitions. This commit includes possible style modifications with the openpower env name as an example. To see the openpower changes, add the variable definition VUE_APP_NAME="openpower" to your .env.development.local file or build using 'npm run build -- --mode openpower' - Moves helper imports into vue config to allow for specific import order - Removed helper imports in SFCs Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: Iaf7a59c24fda06a7b74e23f2f042fb3300cb2056
Diffstat (limited to 'vue.config.js')
-rw-r--r--vue.config.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/vue.config.js b/vue.config.js
index c681f470..81763622 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,6 +1,39 @@
const CompressionPlugin = require('compression-webpack-plugin');
module.exports = {
+ css: {
+ loaderOptions: {
+ sass: {
+ prependData: () => {
+ const envName = process.env.VUE_APP_ENV_NAME;
+ if (envName !== undefined) {
+ // If there is an env name defined, import Sass
+ // overrides.
+ // It is important that these imports stay in this
+ // order to make sure enviroment overrides
+ // take precedence over the default BMC styles
+ return `
+ @import "@/assets/styles/bmc/helpers";
+ @import "@/env/assets/styles/_${process.env.VUE_APP_ENV_NAME}";
+ @import "@/assets/styles/bootstrap/_helpers";
+ `;
+ } else {
+ // Include helper imports so single file components
+ // do not need to include helper imports
+
+ // BMC Helpers must be imported before Bootstrap helpers to
+ // take advantage of Bootstrap's use of the Sass !default
+ // statement. Moving this helper after results in Bootstrap
+ // variables taking precedence over BMC's
+ return `
+ @import "@/assets/styles/bmc/helpers";
+ @import "@/assets/styles/bootstrap/_helpers";
+ `;
+ }
+ }
+ }
+ }
+ },
devServer: {
https: true,
proxy: {