mirror of https://github.com/onweru/compose.git

weru
06.31.2020 a5e95a82037fef350b0178b689ccd7972ee7208e
add a js variables definition file
1 files added
1 files modified
19 ■■■■■ changed files
assets/js/variables.js 14 ●●●●● patch | view | raw | blame | history
layouts/partials/scripts.html 5 ●●●● patch | view | raw | blame | history
assets/js/variables.js
New file
@@ -0,0 +1,14 @@
// global variables;
const doc = document.documentElement;
const toggleId = 'toggle';
const showId = 'show';
const menu = 'menu';
// defined in config.toml
const parentURL = '{{ absURL "" }}';
// defined in i18n / translation files
const quickLinks = '{{ T "quick_links" }}';
const searchResultsLabel = '{{ T "search_results_label" }}';
const typeToSearch = '{{ T "type_to_search" }}';
const noMatchesFound = '{{ T "no_matches" }}';
layouts/partials/scripts.html
@@ -1,3 +1,6 @@
{{- $variablesPath := "js/variables.js" }}
{{- $variables := resources.Get $variablesPath | resources.ExecuteAsTemplate $variablesPath . }}
{{- $funcPath := "js/functions.js" }}
{{- $functions := resources.Get $funcPath | resources.ExecuteAsTemplate $funcPath . }}
@@ -10,7 +13,7 @@
{{- $mainScriptPath := "js/index.js" }}
{{- $main := resources.Get $mainScriptPath | resources.ExecuteAsTemplate $mainScriptPath . }}
{{- $bundle := slice $functions $main | resources.Concat "js/bundle.js" | resources.Minify | resources.Fingerprint "sha512" }}
{{- $bundle := slice $variables $functions $main | resources.Concat "js/bundle.js" | resources.Minify | resources.Fingerprint "sha512" }}
{{- $bundle2 := slice $lunr $search | resources.Concat "js/search.js" | resources.Minify | resources.Fingerprint "sha512" }}
<script src="{{ $bundle.Permalink }}"></script>
<script src="{{ $bundle2.Permalink }}" async defer></script>