diff options
author | Hanzei <hanzei@mailbox.org> | 2018-07-13 11:55:02 +0300 |
---|---|---|
committer | Hanzei <hanzei@mailbox.org> | 2018-07-13 11:55:02 +0300 |
commit | 986d2493916ea31b492f220e743361bca6c3d737 (patch) | |
tree | 6d4d76dcb673905825443b003bea783cf6a07b45 /layouts | |
parent | f5c0d492d3f7c7e4c1139cda12128ab9deae8eeb (diff) |
Bundle assets
Update dependencies
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/footer/scripts.html | 28 | ||||
-rw-r--r-- | layouts/projects/single.html | 9 |
2 files changed, 17 insertions, 20 deletions
diff --git a/layouts/partials/footer/scripts.html b/layouts/partials/footer/scripts.html index 0c7a3a5..bb81fc7 100644 --- a/layouts/partials/footer/scripts.html +++ b/layouts/partials/footer/scripts.html @@ -1,21 +1,15 @@ -<!-- jQuery --> -<script src="{{ "/js/jquery-3.3.1.min.js" | relURL }}"></script> +{{ $jQuery := resources.Get "vendor/jquery/jquery-3.3.1.min.js" }} +{{ $index := resources.Get "js/index.js" | resources.ExecuteAsTemplate "js/index.tmp.css" . | minify }} -<!-- index.js --> -<script defer src="{{ "/js/index.js" | relURL }}"></script> - -<!-- local time --> -{{ if .Site.Params.localTime }} -<script defer src="{{ "/js/moment.js" | relURL }}"></script> -<script defer src="{{ "/js/moment-timezone.js" | relURL }}"></script> -<script defer src="{{ "/js/moment-timezone-with-data-2012-2022.js" | relURL }}"></script> -<script> - $(document).ready(function() { - var time = moment().tz("{{ .Site.Params.timeZone }}").format("h:mm A"); - $('#time').html(time); - }) -</script> +{{ if and .Site.Params.localTime .Page.IsHome }} +{{ $momentjs := resources.Get "vendor/momentjs/moment.min.js" }} +{{ $momentTimezone := resources.Get "vendor/momentjs/moment-timezone.min.js" }} +{{ $momentTimezoneWithData := resources.Get "vendor/momentjs/moment-timezone-with-data-2012-2022.min.js" }} +{{ $scripts := slice $jQuery $momentjs $momentTimezone $momentTimezoneWithData $index | resources.Concat "/js/bundleMoment.js" | fingerprint }} +<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> +{{ else }} +{{ $scripts := slice $jQuery $index | resources.Concat "/js/bundle.js" | fingerprint }} +<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> {{ end }} -<!-- Google Analytics --> {{ template "_internal/google_analytics_async.html" . }} diff --git a/layouts/projects/single.html b/layouts/projects/single.html index c00055c..557aa98 100644 --- a/layouts/projects/single.html +++ b/layouts/projects/single.html @@ -30,12 +30,15 @@ {{ end }} {{ define "customCSS" }} -<link rel="stylesheet" href="{{ "css/owl.carousel.min.css" | relURL }}"> -<link rel="stylesheet" href="{{ "css/owl.theme.default.min.css" | relURL }}"> +{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.css" }} +{{ $owlCarouselTheme := resources.Get "vendor/owlCarousel/owl.theme.default.min.css" }} +{{ $owlCarouselBundle := slice $owlCarousel $owlCarouselTheme | resources.Concat "/css/owlCarousel.min.css" | fingerprint }} +<link rel="stylesheet" href="{{ $owlCarouselBundle.Permalink }}" integrity="{{ $owlCarouselBundle.Data.Integrity }}" media="screen"> {{ end }} {{ define "customScripts" }} -<script src="{{ "js/owl.carousel.min.js" | relURL }}"></script> +{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.js" | fingerprint }} +<script src="{{ $owlCarousel.Permalink }}" integrity="{{ $owlCarousel.Data.Integrity }}"></script> <script> $(document).ready(function(){ $(".owl-carousel").owlCarousel({ |