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.

Syntax

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 How to uninstall Cocoapods from the Mac OS? #6 PHP Login System using PDO Part 1: Create User Registration Page

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
How to Pop an Alert Box in PHP?JavaScriptHow to Sort (Shuffle) an Array in Random Order in JavaScript?JavaScriptHow to add Lifecycle Methods to a Class in React?ReactWhy does MOV matter in IT or any kind of projects?MiscellaneousSteps to Install Microsoft SQL Server on a MacOSSQL/MySQLWordPress: How to display fields from ACF Flexible Contents?WordPressHow to convert datetime to date format in JavaScript?JavaScriptSQL Right JoinSQL/MySQLHow to change CSS with JavaScript?CSSHow to remove WordPress TinyMCE Editor buttons?WordPressA Quick Guide to Object-Oriented Programming in PHPPHP2 Ways We Can Write Multiple Line Commands in PHPPHP