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
  • #35847
Closed
Open
Issue created Feb 16, 2022 by Administrator@rootContributor2 of 2 checklist items completed2/2 checklist items

Providing btn stylings as placeholder/silent classes

Created by: saitho

Prerequisites

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

Proposal

Placeholders or silent classes(%-prefix) are blocks that contain stylings but are not rendered to CSS if not used by a class.

I propose adding silent classes to all basic button stylings in scss/_buttons.scss, so they can be extended from without bloat.

Example:

.btn, %btn {
   // button stylings here
}

Motivation and context

We use external JavaScripts that embed own HTML structures that do not use Bootstrap.

We then apply the Bootstrap button stylings to the elements via @extend:

.external-component-button {
  @extends .btn;
}

The issue is that extending classes will extend ALL usages of the .btn class, even nested ones. This results in a multitude of selectors that are not even needed (bloated selectors). The solution is extending from a silent class aka placeholder:

.external-component-button {
  @extends %btn;
}

More information on that topic here: https://jdsteinbach.com/sass/use-extend/

Assignee
Assign to
Time tracking