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

View File

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

View File

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