mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
chore(carosel): prevent style tag in HTML
this approach does not need to change the assets or the vendor file and the live reload is also supported
This commit is contained in:
@@ -2,6 +2,20 @@
|
|||||||
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
|
{{ $aspect := default "16-9" (.Get "aspectRatio") }}
|
||||||
{{ $interval := default "2000" (.Get "interval") }}
|
{{ $interval := default "2000" (.Get "interval") }}
|
||||||
|
|
||||||
|
{{ $carouselItemCSS := printf
|
||||||
|
`
|
||||||
|
#%s [data-twe-carousel-item] {
|
||||||
|
transition-duration: %sms !important;
|
||||||
|
}` $id $interval }}
|
||||||
|
{{ $carouselInitCSS := printf
|
||||||
|
`
|
||||||
|
#%s [data-twe-carousel-init] {
|
||||||
|
--twe-carousel-interval: %s;
|
||||||
|
}` $id $interval }}
|
||||||
|
{{ $cssContent := printf "%s%s" $carouselItemCSS $carouselInitCSS }}
|
||||||
|
{{ $css := resources.FromString (printf "css/carousel-%s.css" $id) $cssContent | minify | resources.Fingerprint (.Site.Params.fingerprintAlgorithm | default "sha512") }}
|
||||||
|
<link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
|
||||||
|
|
||||||
{{ $page := .Page.Resources }}
|
{{ $page := .Page.Resources }}
|
||||||
{{ $imagesTemp := .Get "images" }}
|
{{ $imagesTemp := .Get "images" }}
|
||||||
{{ $imagesTemp = strings.TrimPrefix "{" $imagesTemp }}
|
{{ $imagesTemp = strings.TrimPrefix "{" $imagesTemp }}
|
||||||
@@ -16,14 +30,6 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<style>
|
|
||||||
#{{ $id }} [data-twe-carousel-item] {
|
|
||||||
transition-duration: {{ $interval }}ms !important;
|
|
||||||
}
|
|
||||||
#{{ $id }} [data-twe-carousel-init] {
|
|
||||||
--twe-carousel-interval: {{ $interval }};
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="{{ $id }}"
|
id="{{ $id }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user