Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #38188
Closed
Open
Issue created Mar 07, 2023 by stijn7621@stijn76212 of 2 checklist items completed2/2 checklist items

Use a mixin for setting bs css variables

Prerequisites

  • I have searched for duplicate or closed feature requests
  • I have read the contributing guidelines

Proposal

In my opinion it would be nice to use some kind of a mixin to set bs css variables. For example we could use this mixin to set css variables. In this way users don't require to start the var name with the $prefix variable when they are customizing bootstrap to their own needs.

@mixin set-var($name, $value) {
    --#{$prefix}#{$name}: #{$value};
}

.card-primary {
$background: blue;
$border: if($color == $color-contrast-light, shade-color($background, 10%), tint-color($background, 10%));
$color: color-contrast($background);

    @include set-var(card-border-color, $border);
    @include set-var(card-cap-bg, $background);
    @include set-var(card-cap-color, $color);
    @include set-var(card-color, $color);
    @include set-var(card-bg, tint-color($background, 5%));
}

Motivation and context

I see a lot of repetitive variables using the $prefix variable directly in sass. In my opinion this could be better, so that users who like to customize bootstrap don't have to do much

Assignee
Assign to
Time tracking