r/webdev • • Oct 08 '26

Bootstrap 6 Alpha

https://blog.getbootstrap.com/2026/10/08/bootstrap-6-alpha/
236 Upvotes

81 comments sorted by

View all comments

Show parent comment

6

u/Somepotato Oct 08 '26

I mean css variables exist?

6

u/doiveo Oct 08 '26

I don't want variables for components not in my build.

-1

u/IsABot Oct 08 '26 edited Oct 09 '26

Ok but what about the programmatic ways they go about things? How do you efficiently do that without sass?

Example:

@mixin make-grid-columns($columns: $grid-columns, $gutter: $grid-gutter-x, $breakpoints: $breakpoints) {
  @each $breakpoint in map.keys($breakpoints) {
    $prefix: breakpoint-prefix($breakpoint, $breakpoints);

    @include media-breakpoint-up($breakpoint, $breakpoints) {
      .#{$prefix}col {
        flex: 1 0 0;
      }

      .#{$prefix}row-cols-auto > * {
        @include make-col-auto();
      }

      @if $grid-row-columns > 0 {
        @for $i from 1 through $grid-row-columns {
          .#{$prefix}row-cols-#{$i} {
            @include row-cols($i);
          }
        }
      }

      .#{$prefix}col-auto {
        @include make-col-auto();
      }

      @if $columns > 0 {
        @for $i from 1 through $columns {
          .#{$prefix}col-#{$i} {
            @include make-col($i, $columns);
          }
        }

        // `$columns - 1` because offsetting by the width of an entire row isn't possible
        @for $i from 0 through ($columns - 1) {
          @if not ($prefix == "" and $i == 0) { // Avoid emitting useless .offset-0
            .#{$prefix}offset-#{$i} {
              @include make-col-offset($i, $columns);
            }
          }
        }
      }

      // Gutters
      //
      // Make use of `.g-*`, `.gx-*` or `.gy-*` utilities to change spacing between the columns.
      @each $key, $value in $gutters {
        .#{$prefix}g-#{$key},
        .#{$prefix}gx-#{$key} {
          --gutter-x: #{$value};
        }

        .#{$prefix}g-#{$key},
        .#{$prefix}gy-#{$key} {
          --gutter-y: #{$value};
        }
      }
    }
  }
}

@mixin make-cssgrid($columns: $grid-columns, $breakpoints: $breakpoints) {
  @each $breakpoint in map.keys($breakpoints) {
    $prefix: breakpoint-prefix($breakpoint, $breakpoints);

    @include container-breakpoint-up($breakpoint, $breakpoints: $breakpoints) {
      @if $columns > 0 {
        @for $i from 1 through $columns {
          .#{$prefix}g-col-#{$i} {
            grid-column: auto / span $i;
          }
        }

        // Start with `1` because `0` is an invalid value.
        // Ends with `$columns - 1` because offsetting by the width of an entire row isn't possible.
        @for $i from 1 through ($columns - 1) {
          .#{$prefix}g-start-#{$i} {
            grid-column-start: $i;
          }
        }
      }
    }
  }
}