Refactored configuration format

This commit is contained in:
squidfunk 2020-03-05 16:43:29 +01:00
parent 36d5c33b33
commit 3b9225c6a1
3 changed files with 18 additions and 17 deletions

View File

@ -23,7 +23,6 @@
{% import "partials/language.html" as lang with context %}
<!-- Theme options -->
{% set feature = config.theme.feature %}
{% set palette = config.theme.palette %}
{% set font = config.theme.font %}
@ -238,7 +237,7 @@
<!-- Tabs with outline -->
{% block tabs %}
{% if feature.tabs %}
{% if "tabs" in config.theme.features %}
{% include "partials/tabs.html" %}
{% endif %}
{% endblock %}
@ -341,6 +340,13 @@
{% endblock %}
</div>
<!-- Application configuration -->
{% block config %}
<script>
var __config = {}
</script>
{% endblock %}
<!-- Theme-related JavaScript -->
{% block scripts %}
<script src="{{ 'assets/javascripts/vendor.js' | url }}"></script>
@ -367,15 +373,15 @@
<!-- Application initialization -->
<script>
app = initialize({
base: "{{ base_url }}",
worker: {
search: "{{ 'assets/javascripts/worker/search.js' | url }}"
__material = initialize(Object.assign({
url: {
base: "{{ base_url }}",
worker: {
search: "{{ 'assets/javascripts/worker/search.js' | url }}"
}
},
feature: {
instant: {{ "true" if feature and feature.instant else "false" }}
}
});
features: {{ config.theme.features | tojson }}
}, __config))
</script>
<!-- Custom JavaScript -->

View File

@ -20,12 +20,9 @@
IN THE SOFTWARE.
-->
<!-- Theme options -->
{% set feature = config.theme.feature %}
<!-- Determine class according to level -->
{% set class = "md-hero" %}
{% if not feature.tabs %}
{% if "tabs" not in config.theme.features %}
{% set class = "md-hero md-hero--expand" %}
{% endif %}

View File

@ -20,10 +20,8 @@
IN THE SOFTWARE.
-->
<!-- Import translations for given language -->
<!-- Import translations for given language and fallback -->
{% import "partials/language/" + config.theme.language + ".html" as lang %}
<!-- Import fallback translations -->
{% import "partials/language/en.html" as fallback %}
<!-- Re-export translations -->