Sass extends CSS’s @import so you can load Sass and CSS stylesheets at compile time: mixins, functions, and variables become available, and CSS is combined in place. Unlike browser CSS imports, this does not add extra HTTP requests while the page renders.
As of Dart Sass 1.80.0, @import is deprecated and will be removed in Dart Sass 3.0.0. Prefer @use and @forward. Learn @import to read legacy code and migrate safely.
Official stance.
Per the Sass docs: globals, duplicate CSS, and unpredictable @extend are why the module system replaces @import. Use the official Sass migrator on entrypoints when you can.
Partials.
Files meant only to be imported start with _ (for example _code.scss). You can omit the underscore and extension when importing.
Do not use in new projects.
Start with @use. Keep @import only for temporary legacy support or plain CSS passthrough (fonts, CDN, media-query imports).
These examples show how legacy @import behaves so you can recognize and migrate it. Prefer @use in new projects. Open View Compiled CSS for verified output.
Example 1 — Basic Multi-File Import
Comma-separated imports pull CSS from multiple partials.
Module loads once even if other files also @use it.
This is the pattern to use going forward.
Edge Cases & Pitfalls
Most @import trouble is deprecation, duplicate CSS, globals, or confusing Sass loads with CSS passthrough.
deprecated
Removed in Dart Sass 3.0
Do not start new work on @import. Migrate with the official Sass migrator when possible.
duplicate
Imported twice = CSS twice
Unlike @use, importing the same file again re-evaluates it and can re-emit its rules.
.css
Explicit .css is passthrough
Write @import "code" to load code.css as Sass. Write @import "code.css" to leave a browser import.
paths
Use forward slashes
Sass resolves imports as URLs. Even on Windows, write foundation/code, not backslashes.
Toolchain
Sass Support
@import still works today for compatibility, but the language is moving to the module system. Prefer Dart Sass and plan migration before 3.0.
Implementation
Status
Dart Sass
Supported but deprecated (1.80+); removed in 3.0
LibSass / node-sass
Supported (no @use; deprecated toolchain)
Ruby Sass
Supported (end-of-life)
Browsers
Only see compiled CSS or plain CSS @imports
Prefer Dart Sass for new projects. SCSS and indented syntax both support @import.
Remember
Key Takeaways
Deprecated: prefer @use / @forward for all new work.
Compile-time: Sass inlines files; members become global.
Plain CSS imports ( .css, url(), media) stay for the browser.
Migrate early before Dart Sass 3.0 removes @import.
One line: know @import for legacy code — ship new Sass with @use.
Compile
Compile Notes
Conceptual flow for a Sass (not plain CSS) import:
flow.txt
1. Resolve the URL (partials, load paths, index files)
2. If plain-CSS pattern → emit browser @import and stop
3. Otherwise evaluate the file in place of the @import
4. Expose members globally; emit CSS at that point
5. Plan replacement with @use / @forward
Frequently Asked Questions
Yes. As of Dart Sass 1.80.0, @import is deprecated and will be removed in Dart Sass 3.0.0. Prefer @use (and @forward for library entrypoints).
It loads another Sass or CSS stylesheet at compile time, combining CSS and making mixins, functions, and variables available. Unlike browser CSS @import, it does not add extra HTTP requests at render time.
It makes members global, encourages long prefixes, makes @extend unpredictable, can duplicate CSS when a file is imported multiple times, and has no private members.
Prefer rewriting imports as @use / @forward. Sass provides an official migration tool that converts most @import-based code automatically.
When the URL ends with .css, starts with http(s)://, is written as url(), or includes media queries—Sass leaves those as CSS @import in the output.
Yes. Nested imports scope the imported CSS under a selector or at-rule. For new code, prefer a mixin or meta.load-css() instead.