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.

@extend css tag from module (@use)

See original GitHub issue

I’m currently upgrading a scss project from @import to the new module system with @use. Everything is going great except for the @extend at-rule. I’m unable to find anything in the documentation on how to tell sass that the tag being extended comes from another module.

This does not work:

@use "./colors.scss" as colors;

body {
  @extend .element; // not working
  @extend colors, .element; // not working
}

Example: https://stackblitz.com/edit/angular-tufq7f?file=src%2Fstyles.scss

Is this an intentional breaking change? Is the solution missing from the official docs? Any suggestions are appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jathakcommented, Jan 8, 2020

This code works when run directly with the latest version of Dart Sass.

It looks like you’re using a version of Sass that doesn’t support the module system. Please make sure you’re using Dart Sass 1.23.0 or later (libsass/Node Sass don’t support the module system)

1reaction
jathakcommented, Jan 8, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

The Extend Concept | CSS-Tricks
The Stylus Way. Stylus uses @extend and works largely similar to Sass. .module padding 10px h3 color red .news @extend .module. Outputs:
Read more >
Sass: @extend
Sass's @extend rule solves this. It's written @extend <selector> , and it tells Sass that one selector should inherit the styles of another....
Read more >
Sass extend class from module - Stack Overflow
This gives the following error: "body" failed to @extend ".element". The selector ".element" was not found. Use "@extend .element ...
Read more >
CSS Modules by Example - JavaScript Stuff
CSS Modules are a means to achieve locally scoped CSS class names. ... In your component, you must put one class names on...
Read more >
Sass @extend and Inheritance - W3Schools
By using the @extend directive, you do not need to specify several classes for an element in your HTML code, like this: <button...
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