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.

Nested imports / variables broken in 5.1

See original GitHub issue

In v5.0.2, it is possible to import a customized bootstrap sass file within a selector:

.new-design-system {
   @import 'bootstrap-custom'
}

With this, and BS5’s new namespace, it is possible to have an older version of bootstrap side-by-side with a compartmentalized custom BS5, javascript and all. While not arguably not ideal (or not officially supported), this is extremely useful when iterating over an application with a legacy design system and gradually incorporating a new BS5-based design system.

In v5.1.0, this functionality is broken as the sass will not compile without importing functions, variables, and root at the root level, which also breaks the customizations.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
GUIcommented, Sep 4, 2021

I think this is maybe related to this this libsass bug: https://github.com/sass/libsass/issues/2830

I also ran into this when using libsass 3.6.5. However, I found a couple potential workarounds:

  1. Use dart-sass instead. The original approach of importing bootstrap inside a nested selector seems to work with dart-sass (I tested with dart-sass-embedded 1.0.0-beta.11).

  2. I was also able to get it to work with libsass by importing the bootstrap functions into the top-level namespace. This still accomplishes what I was trying to achieve (namespacing the Bootstrap CSS classes), but this seems to sidestep the issue of libsass not finding functions defined in a nested scope:

    @import "bootstrap/scss/_functions";
    .my-wrapper {
      @import "bootstrap/scss/bootstrap";
    }
    
4reactions
stephenhebertcommented, Aug 27, 2021

I just attempted to reproduce the issue in a sandbox environment, but I wasn’t able to.

https://codesandbox.io/s/nested-bootstrap-5-25dud

It must be related to my configuration – possibly the python sass compiler.

The error I’m seeing in my environment is:

CompileError at ...
Error: Function not found: to-rgb
...
>> $_map: map-merge($_map, ($key: call(get-function($func), $_args...)));
Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested Route Bug (forked) - StackBlitz
import { Route } from 'react-router-dom';. import { IonApp, IonRouterOutlet } from. '@ionic/react'; ... Theme variables */. import LoginPage from '.
Read more >
Nested field type | Elasticsearch Guide [8.5] | Elastic
The nested type is a specialised version of the object data type that allows arrays of objects to be indexed in a way...
Read more >
Understanding and Building PowerShell Modules
Learn how to do powershell module path so you can use the same code in many places without copying and pasting to code....
Read more >
Unreal Engine 5.1 Release Notes
Texture and Texture Asset Editor Improvements. Textures and The Texture Asset Editor includes the following improvements for this release: You can now import...
Read more >
Google Java Style Guide
5 Naming: 5.1 Rules common to all identifiers: 5.2 Rules by identifier type: 5.3 Camel case: ... Static import is not used for...
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