question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clearly document whether a component (or example) is dependent on other SCSS files

See original GitHub issue

Clearly document whether a component is dependent on other Bootstrap SCSS files in Bootstrap 4.x.

Some components are dependent on other SCSS Bootstrap classes for full or partial functionality. Document these clearly for each component, so that new users to Bootstrap 4.x can use this clearly.

The documentation on on importing SCSS classes is thin, and making many of the examples on the documentation website work involves troubleshooting imports.

Example use case:

When using the Navbar component in Bootstrap 4.x, the documentation on importing SCSS classes is woefully thin. Based purely on the instruction to look at bootstrap.scss’s import order, one might assume based on filename alone that you would only need to import navbar in your custom SCSS file like so:

@import "bootstrap/scss/navbar";

The reality is that the Navbar class depends on a minimum of the following:

//Required
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/mixins";

@import "bootstrap/scss/transitions";

In most use cases, it also requires the following:

//If using dropdowns for submenus
@import "bootstrap/scss/dropdown";

// If right-aligning anything
@import "bootstrap/scss/utilities";

To make the first example on the docs page work with a copy-and-paste, you also need the following:

// Styles the searchbox 

@import "bootstrap/scss/forms";
@import "bootstrap/scss/buttons";

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
celestehorgancommented, Sep 24, 2020

👋

Hi, I logged this because I’m actually a technical writer with the Cloud Native Computing Foundation 😃

My suggestion for you, from a documentation/writing standpoint is to document it on each component’s page: For example, for Navbar, I’d include a section called “Prerequisites” or “Dependencies”, directly before or after “How it works” or after.

Something like this:


Dependencies

If you are importing Bootstrap modularly, you must import the following for Navbar to render correctly: (or smth along these lines)

@import blah
@import blah
@import navbar

How it works

… //etc

1reaction
mdocommented, Sep 24, 2020

WIP of doing something small in our Sass files to get started: https://github.com/twbs/bootstrap/pull/31744.

As a bonus, as previous comments mentioned, getting this going will help us all out for that Dart Sass move if/when we migrate into the new module system.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sass: @use
The @use rule loads mixins, functions, and variables from other Sass stylesheets, and combines CSS from multiple stylesheets together. Stylesheets loaded by @ ......
Read more >
css - SASS - use variables across multiple files - Stack Overflow
You can do it like this: I have a folder named utilities and inside that I have a file named _variables.scss. in that...
Read more >
HTML: A good basis for accessibility - Learn web development
You should now be well-versed in writing accessible HTML for most occasions. Our WAI-ARIA basics article will help to fill gaps in this ......
Read more >
ASP.NET Core Blazor CSS isolation - Microsoft Learn
For an Example component in an Example.razor file, create a file alongside the component named Example.razor.css . The Example.razor.css file ...
Read more >
Best Practices - Cypress Documentation
Best Practice: Use data-* attributes to provide context to your selectors and isolate them from CSS or JS changes. Every test you write...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found