I think you might be conflating a few different things here.
In Sass/SCSS, @import is used to add additional programmatic resources to a Sass file/context and/or to bundle together additional styles. This is all done at compilation time, so there will be a single bundled file to be delivered to the browser, with no additional HTTP calls necessary (for CSS). From the Sass @import reference page:
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining multiple stylesheets' CSS together. Unlike plain CSS imports, which require the browser to make multiple HTTP requests as it renders your page, Sass imports are handled entirely during compilation.
(Also, it is deprecated and slated for removal, intended to be replaced by the @use rule.)
In CSS, @import behaves by making additional HTTP requests to fetch and load additional CSS files asynchronously and as needed. From the MDN CSS @import reference:
The @import CSS at-rule is used to import style rules from other style sheets. ... So that user agents can avoid retrieving resources for unsupported media types, authors may specify media-dependent @import rules. These conditional imports specify comma-separated media queries after the URL. In the absence of any media query, the import is unconditional. Specifying all for the medium has the same effect.
Critically, this type of dynamic fetching based on browser support could only be done in each individual browser, not precompiled.
From your question, you write:
...does it prevent multiple link tags in a single html file?
I'm not sure either instance does what you are suggesting. I do think that sometimes in a development mode, your bundling process may opt to just inject several <style/> blocks or <link/> elements rather than bundling all the CSS. I suppose logically in both Sass and CSS contexts the @import is technically replacing or otherwise preventing the need for several <link/> elements from being added, but that is a bit of a simplification of how/why they are used.
I think you might be conflating a few different things here.
In Sass/SCSS,
@import
is used to add additional programmatic resources to a Sass file/context and/or to bundle together additional styles. This is all done at compilation time, so there will be a single bundled file to be delivered to the browser, with no additional HTTP calls necessary (for CSS). From the Sass@import
reference page:(Also, it is deprecated and slated for removal, intended to be replaced by the
@use
rule.)In CSS,
@import
behaves by making additional HTTP requests to fetch and load additional CSS files asynchronously and as needed. From the MDN CSS@import
reference:Critically, this type of dynamic fetching based on browser support could only be done in each individual browser, not precompiled.
From your question, you write:
I'm not sure either instance does what you are suggesting. I do think that sometimes in a development mode, your bundling process may opt to just inject several
<style/>
blocks or<link/>
elements rather than bundling all the CSS. I suppose logically in both Sass and CSS contexts the@import
is technically replacing or otherwise preventing the need for several<link/>
elements from being added, but that is a bit of a simplification of how/why they are used.