mirror of
https://github.com/bastienwirtz/homer.git
synced 2025-01-13 01:18:23 +01:00
Merge pull request #113 from gabe565/custom-stylesheet
Add support for a custom stylesheet
This commit is contained in:
commit
83665e4f48
@ -26,6 +26,11 @@ connectivityCheck: true # whether you want to display a message when the apps ar
|
|||||||
# Optional theming
|
# Optional theming
|
||||||
theme: default # 'default' or one of the theme available in 'src/assets/themes'.
|
theme: default # 'default' or one of the theme available in 'src/assets/themes'.
|
||||||
|
|
||||||
|
# Optional custom stylesheet
|
||||||
|
# Will load custom CSS files. Especially useful for custom icon sets.
|
||||||
|
# stylesheet:
|
||||||
|
# - "assets/custom.css"
|
||||||
|
|
||||||
# Here is the exaustive list of customization parameters
|
# Here is the exaustive list of customization parameters
|
||||||
# However all value are optional and will fallback to default if not set.
|
# However all value are optional and will fallback to default if not set.
|
||||||
# if you want to change only some of the colors, feel free to remove all unused key.
|
# if you want to change only some of the colors, feel free to remove all unused key.
|
||||||
|
12
src/App.vue
12
src/App.vue
@ -160,6 +160,13 @@ export default {
|
|||||||
this.config = merge(defaults, config);
|
this.config = merge(defaults, config);
|
||||||
this.services = this.config.services;
|
this.services = this.config.services;
|
||||||
document.title = `${this.config.title} | ${this.config.subtitle}`;
|
document.title = `${this.config.title} | ${this.config.subtitle}`;
|
||||||
|
if (this.config.stylesheet) {
|
||||||
|
let stylesheet = '';
|
||||||
|
for (const file of this.config.stylesheet) {
|
||||||
|
stylesheet += `@import "${file}";`;
|
||||||
|
}
|
||||||
|
this.createStylesheet(stylesheet);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getConfig: function (path = "assets/config.yml") {
|
getConfig: function (path = "assets/config.yml") {
|
||||||
@ -235,6 +242,11 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
createStylesheet: function(css) {
|
||||||
|
let style = document.createElement('style');
|
||||||
|
style.appendChild(document.createTextNode(css));
|
||||||
|
document.head.appendChild(style);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user