Add a early js script.
This commit is contained in:
parent
35c1c9f20f
commit
88054afa22
3 changed files with 16 additions and 2 deletions
13
assets/js/script-early.js
Normal file
13
assets/js/script-early.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* @file
|
||||
* A JavaScript file for the theme. Runs first, before jQuery etc. have loaded.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Add a js class to the html-tag when JavsScript is active.
|
||||
document.querySelector('html').classList.replace('nojs', 'js');
|
||||
|
||||
})();
|
||||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
// Add a js class to the html-tag when JavsScript is active.
|
||||
$('html').removeClass('nojs').addClass('js');
|
||||
// Place your code here.
|
||||
|
||||
})(u);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
{{ $early := resources.Get "js/script-early.js" | minify | fingerprint -}}
|
||||
<script src="{{ $early.RelPermalink }}"></script>
|
||||
{{ if $.Param "jquery" -}}
|
||||
{{ $jquery := resources.Get "js/lib/jquery.slim.min.js" | fingerprint -}}
|
||||
<script defer src="{{ $jquery.RelPermalink }}"></script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue