Yogesh Chauhan's Blog

The basics of @import rule in SCSS (Sass)

in SCSS on June 7, 2021

@import rule is not an invention from SassScript. It has actually derived the rule from CSS. Using the @import rule, you can import CSS and SCSS (Sass) files.

You can access the members (functions, variables and mixins) from another modules after you import those modules. Bunch of CSS files you want to combine? Use @import to do so.

The difference between CSS imports and SCSS (Sass) imports is that SCSS imports are handled completely during the compilation of the files while CSS imports require the browser to make multiple requests.


CSS and SCSS imports have the same syntax. The advantage of SCSS imports is that you can import multiple files in a single import statement like this:

@import 'foundation/code', 'foundation/lists';

Note that you don’t need to use quotes while importing URLs in Sass (indented) syntax.

Sass will remove @import rules entirely in future. Use @use rule instead.

Most Read

#1 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
WordPress: How to print ACF repeater field values?WordPressHow to convert a function component into a class in React?ReactHow to create a secure random number using JavaScript?JavaScriptHow to define variables in SCSS (Sass)?SCSSHow to insert Bootstrap 4 in Angular 9 app?AngularINTERSECT and EXCEPT in PostgresPostgresUseful (and probably ignored) HTML tags: Part 2HTMLHow to create a placeholder loader (throbber) using CSS?CSSHow to zoom an element on hover using CSS?CSSHow to add transparent text on top of an image using CSS?CSSWhat happened to your Google Analytics Tracking ID, can’t find it?MiscellaneousHow to make a Custom Login Page in WordPress?WordPress