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.

Removing @import should be stopped

See original GitHub issue

I agree that we need local vars. But at the same time, global var does bring benefit for certain reason. Moreover, @use does not have some good features like @import, which it supposed to have. For instance, nesting is a very important one that @use should have. But it doesn’t.

On the global, we need it to set global configuration (a fixed one). Please refer #2750

For now, I decide to use both for whatever convenient for me. But I sure hope that we didn’t remove @import and add nesting to @use. Or I will have a tons of extra lines in my code.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jathakcommented, Oct 9, 2019

The main difference between @use and load-css is that @use allows access to a file’s variables, functions, and mixins, while load-css only includes a file’s generated CSS. One of the goals of the module system is to make it easy to find where a given variable, function, or mixin comes from. To ensure that, we require that @use is at the top-level of a file, before most other rules, and that it refers to a static URL.

Given most nested @imports only cared about the CSS that was imported (and not the variables, functions, or mixins), we still support this behavior via load-css. As a bonus, the URL for load-css doesn’t have to be a static string like @import.

You may find it helpful to refer to the “Goals” section of the module system spec to understand the reasoning behind these changes.

1reaction
mirisuzannecommented, Oct 7, 2019

Nesting is still supported with the load-css() mixin - even improved because that mixin supports custom configuration and dynamic importing:

@use 'sass:meta';

@each $theme, $file in $themes {
  [data-theme="#{$theme}" {
    @include meta.load-css("themes/#{$file}",
      $with: ("base-color": $brand));
    }
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Any reason to clean up unused imports in Java, other than ...
Removing unused imports is quite simple in both Eclipse and IntelliJ IDEA. Save this answer.
Read more >
How to enable "remove unused imports"
You can remove all of the rules specified in Settings/Preferences | Editor | Code Style | <language> | Imports. Then hitting Ctrl+Alt+O (on ......
Read more >
Help Article | How-To Stop or Undo Data Import - CSV Loader
Select the import you stopped and press the UNDO IMPORT button. Imported records will be cleaned by CSV Loader. Undo Data Import. If...
Read more >
How Removing Tariffs Would Create Jobs and Boost the ...
Removing trade barriers like tariffs would be an effective tool to boost economic growth, connect more people to work, and increase ...
Read more >
Import photos from a camera or phone using Photos on Mac
Photos imports your photos. To cancel importing, click Stop Import. When all photos have been imported, disconnect the camera or device from your...
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