diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-01-12 14:56:19 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-01-12 15:04:14 +0300 |
commit | 3a29ec3cfb21ddd076150bc500d38ef8c56c827c (patch) | |
tree | 4b321723457bc5c31428994447b7c467ca01a114 | |
parent | 4006a62e046be39184cc64e23710c8044f614e7c (diff) |
Upgrade to github.com/twbs/bootstrap v5.0.2
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | assets/scss/bootstrap/_vendor/_rfs.scss | 79 | ||||
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | exampleSite/go.mod | 7 | ||||
-rw-r--r-- | exampleSite/go.sum | 5 | ||||
-rw-r--r-- | exampleSite/layouts/index.html | 5 | ||||
-rw-r--r-- | go.mod | 4 | ||||
-rw-r--r-- | go.sum | 4 |
8 files changed, 94 insertions, 35 deletions
@@ -12,7 +12,7 @@ Add the component to your Hugo site's config: ```toml [module] [[module.imports]] -path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v4" +path = "github.com/gohugoio/hugo-mod-bootstrap-scss/v5" ``` The Bootstrap SCSS will be mounted in `assets/scss/bootstrap`, so you can then import either all: @@ -25,14 +25,18 @@ Or only what you need: ```scss +// Configuration @import "bootstrap/functions"; @import "bootstrap/variables"; @import "bootstrap/mixins"; +@import "bootstrap/utilities"; + +// Layout & components @import "bootstrap/root"; @import "bootstrap/reboot"; @import "bootstrap/type"; @import "bootstrap/images"; -@import "bootstrap/code"; +@import "bootstrap/containers"; @import "bootstrap/grid"; @import "bootstrap/tables"; @import "bootstrap/forms"; @@ -40,18 +44,15 @@ Or only what you need: @import "bootstrap/transitions"; @import "bootstrap/dropdown"; @import "bootstrap/button-group"; -@import "bootstrap/input-group"; -@import "bootstrap/custom-forms"; @import "bootstrap/nav"; @import "bootstrap/navbar"; @import "bootstrap/card"; +@import "bootstrap/accordion"; @import "bootstrap/breadcrumb"; @import "bootstrap/pagination"; @import "bootstrap/badge"; -@import "bootstrap/jumbotron"; @import "bootstrap/alert"; @import "bootstrap/progress"; -@import "bootstrap/media"; @import "bootstrap/list-group"; @import "bootstrap/close"; @import "bootstrap/toasts"; @@ -60,10 +61,14 @@ Or only what you need: @import "bootstrap/popover"; @import "bootstrap/carousel"; @import "bootstrap/spinners"; -@import "bootstrap/utilities"; -@import "bootstrap/print"; -``` +@import "bootstrap/offcanvas"; + +// Helpers +@import "bootstrap/helpers"; +// Utilities +@import "bootstrap/utilities/api"; +``` ## Versions diff --git a/assets/scss/bootstrap/_vendor/_rfs.scss b/assets/scss/bootstrap/_vendor/_rfs.scss index a68e738..7e9a6c7 100644 --- a/assets/scss/bootstrap/_vendor/_rfs.scss +++ b/assets/scss/bootstrap/_vendor/_rfs.scss @@ -4,7 +4,7 @@ // // Automated responsive values for font sizes, paddings, margins and much more // -// Licensed under MIT (https://github.com/twbs/rfs/blob/master/LICENSE) +// Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE) // Configuration @@ -52,12 +52,54 @@ $enable-rfs: true !default; // Cache $rfs-base-value unit $rfs-base-value-unit: unit($rfs-base-value); +@function divide($dividend, $divisor, $precision: 10) { + $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1); + $dividend: abs($dividend); + $divisor: abs($divisor); + @if $dividend == 0 { + @return 0; + } + @if $divisor == 0 { + @error "Cannot divide by 0"; + } + $remainder: $dividend; + $result: 0; + $factor: 10; + @while ($remainder > 0 and $precision >= 0) { + $quotient: 0; + @while ($remainder >= $divisor) { + $remainder: $remainder - $divisor; + $quotient: $quotient + 1; + } + $result: $result * 10 + $quotient; + $factor: $factor * .1; + $remainder: $remainder * 10; + $precision: $precision - 1; + @if ($precision < 0 and $remainder >= $divisor * 5) { + $result: $result + 1; + } + } + $result: $result * $factor * $sign; + $dividend-unit: unit($dividend); + $divisor-unit: unit($divisor); + $unit-map: ( + "px": 1px, + "rem": 1rem, + "em": 1em, + "%": 1% + ); + @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) { + $result: $result * map-get($unit-map, $dividend-unit); + } + @return $result; +} + // Remove px-unit from $rfs-base-value for calculations @if $rfs-base-value-unit == px { - $rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1); + $rfs-base-value: divide($rfs-base-value, $rfs-base-value * 0 + 1); } @else if $rfs-base-value-unit == rem { - $rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1 / $rfs-rem-value); + $rfs-base-value: divide($rfs-base-value, divide($rfs-base-value * 0 + 1, $rfs-rem-value)); } // Cache $rfs-breakpoint unit to prevent multiple calls @@ -65,22 +107,29 @@ $rfs-breakpoint-unit-cache: unit($rfs-breakpoint); // Remove unit from $rfs-breakpoint for calculations @if $rfs-breakpoint-unit-cache == px { - $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1); + $rfs-breakpoint: divide($rfs-breakpoint, $rfs-breakpoint * 0 + 1); } @else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" { - $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1 / $rfs-rem-value); + $rfs-breakpoint: divide($rfs-breakpoint, divide($rfs-breakpoint * 0 + 1, $rfs-rem-value)); } // Calculate the media query value -$rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{$rfs-breakpoint / $rfs-rem-value}#{$rfs-breakpoint-unit}); +$rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit}); $rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width); $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height); // Internal mixin used to determine which media query needs to be used @mixin _rfs-media-query { @if $rfs-two-dimensional { - @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) { - @content; + @if $rfs-mode == max-media-query { + @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) { + @content; + } + } + @else { + @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) { + @content; + } } } @else { @@ -157,11 +206,11 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @if $unit == px { // Convert to rem if needed - $val: $val + ' ' + if($rfs-unit == rem, #{$value / ($value * 0 + $rfs-rem-value)}rem, $value); + $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value); } @else if $unit == rem { // Convert to px if needed - $val: $val + ' ' + if($rfs-unit == px, #{$value / ($value * 0 + 1) * $rfs-rem-value}px, $value); + $val: $val + ' ' + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value); } @else { // If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value @@ -198,21 +247,21 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height @else { // Remove unit from $value for calculations - $value: $value / ($value * 0 + if($unit == px, 1, 1 / $rfs-rem-value)); + $value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value))); // Only add the media query if the value is greater than the minimum value @if abs($value) <= $rfs-base-value or not $enable-rfs { - $val: $val + ' ' + if($rfs-unit == rem, #{$value / $rfs-rem-value}rem, #{$value}px); + $val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px); } @else { // Calculate the minimum value - $value-min: $rfs-base-value + (abs($value) - $rfs-base-value) / $rfs-factor; + $value-min: $rfs-base-value + divide(abs($value) - $rfs-base-value, $rfs-factor); // Calculate difference between $value and the minimum value $value-diff: abs($value) - $value-min; // Base value formatting - $min-width: if($rfs-unit == rem, #{$value-min / $rfs-rem-value}rem, #{$value-min}px); + $min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px); // Use negative value if needed $min-width: if($value < 0, -$min-width, $min-width); @@ -221,7 +270,7 @@ $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height $variable-unit: if($rfs-two-dimensional, vmin, vw); // Calculate the variable width between 0 and $rfs-breakpoint - $variable-width: #{$value-diff * 100 / $rfs-breakpoint}#{$variable-unit}; + $variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit}; // Return the calculated value $val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')'; diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 46214cd..59972ac 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -11,4 +11,4 @@ home = ["HTML"] min = "0.92.0" [[module.imports]] -path="github.com/gohugoio/hugo-mod-bootstrap-scss/v4"
\ No newline at end of file +path="github.com/gohugoio/hugo-mod-bootstrap-scss/v5"
\ No newline at end of file diff --git a/exampleSite/go.mod b/exampleSite/go.mod index f4d57bc..c40cbe4 100644 --- a/exampleSite/go.mod +++ b/exampleSite/go.mod @@ -1,11 +1,10 @@ -module github.com/gohugoio/hugo-mod-bootstrap-scss/exampleSite/v4 +module github.com/gohugoio/hugo-mod-bootstrap-scss/exampleSite/v5 go 1.17 require ( github.com/bep/empty-hugo-module v1.0.0 // indirect - github.com/gohugoio/hugo-mod-bootstrap-scss/v4 v4.0.0-20220111121503-d09c70837b61 // indirect + github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v5.0.0-00010101000000-000000000000 // indirect ) - -replace github.com/gohugoio/hugo-mod-bootstrap-scss/v4 => ../
\ No newline at end of file +replace github.com/gohugoio/hugo-mod-bootstrap-scss/v5 => ../ diff --git a/exampleSite/go.sum b/exampleSite/go.sum index 5ecb01a..30613b3 100644 --- a/exampleSite/go.sum +++ b/exampleSite/go.sum @@ -1,7 +1,8 @@ github.com/bep/empty-hugo-module v1.0.0 h1:aYc9RWea644CdYjg9zCy8nkVF4KjC3fwhUTvvcXXg8s= github.com/bep/empty-hugo-module v1.0.0/go.mod h1:whohinbSjMoFi/Skivj9kvdPs1tEgzYpZ4rXoQk/0/I= -github.com/gohugoio/hugo-mod-bootstrap-scss/v4 v4.0.0-20220111121503-d09c70837b61 h1:rclBs01LjSeTPeN8/I4VASzgL/14HBnbMio6UQvGlSk= -github.com/gohugoio/hugo-mod-bootstrap-scss/v4 v4.0.0-20220111121503-d09c70837b61/go.mod h1:QOfRknwQ8SbtzgHn+dkR+lnLbVSCG8U/1iqpDxk64QU= +github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v4.0.0-20220111121503-d09c70837b61 h1:rclBs01LjSeTPeN8/I4VASzgL/14HBnbMio6UQvGlSk= +github.com/gohugoio/hugo-mod-bootstrap-scss/v5 v4.0.0-20220111121503-d09c70837b61/go.mod h1:QOfRknwQ8SbtzgHn+dkR+lnLbVSCG8U/1iqpDxk64QU= github.com/twbs/bootstrap v4.6.1+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= +github.com/twbs/bootstrap v5.0.2+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= github.com/twbs/bootstrap v5.1.3+incompatible h1:19+1/69025oghttdacCOGvs1wv9D5lZnpfoCvKUsPCs= github.com/twbs/bootstrap v5.1.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/exampleSite/layouts/index.html b/exampleSite/layouts/index.html index 652097f..a15625b 100644 --- a/exampleSite/layouts/index.html +++ b/exampleSite/layouts/index.html @@ -26,8 +26,9 @@ <body> <div class="container mt-5"> - <h2>Dependencies</h2> - <table class="table table-dark"> + <h1>Bootstrap v5 Hugo Module</h1> + <h2 class="mt-4">Dependencies</h2> + <table class="table table-striped mt-5"> <thead> <tr> <th scope="col">#</th> @@ -1,5 +1,5 @@ -module github.com/gohugoio/hugo-mod-bootstrap-scss/v4 +module github.com/gohugoio/hugo-mod-bootstrap-scss/v5 go 1.16 -require github.com/twbs/bootstrap v4.6.1+incompatible // indirect +require github.com/twbs/bootstrap v5.0.2+incompatible // indirect @@ -6,3 +6,7 @@ github.com/twbs/bootstrap v4.6.0+incompatible h1:gHX/lyS+3sUtHS6AKI365MfWukJ9N/M github.com/twbs/bootstrap v4.6.0+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= github.com/twbs/bootstrap v4.6.1+incompatible h1:75PsBfPU1SS65ag0Z3Cq6JNXVAfUNfB0oCLHh9k9Fu8= github.com/twbs/bootstrap v4.6.1+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= +github.com/twbs/bootstrap v5.0.2+incompatible h1:l13Xy0yyiNKqO78G056lHtLHiW+iiN8P7pf4bh4MPwY= +github.com/twbs/bootstrap v5.0.2+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= +github.com/twbs/bootstrap v5.1.3+incompatible h1:19+1/69025oghttdacCOGvs1wv9D5lZnpfoCvKUsPCs= +github.com/twbs/bootstrap v5.1.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= |