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 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#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 #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
How to get category name using post id in WordPress?WordPressWhat is Prototypal Inheritance in JavaScript?JavaScriptWordPress: How to get ACF field values from another post?WordPressDynamically generate names in SCSS (animation example)SCSSGap in Flex?CSSShort-Circuit Evaluation in JavaScriptJavaScriptWhat is ECMAScript?JavaScriptHow to Draw a Text Image using JavaScript?JavaScriptSolution to Could not cast value of type ‘NSTaggedPointerString’ to ‘NSNumber’SwiftHow to insert Bootstrap 4 in Angular 9 app?AngularHow services and dependency injection work in Angular?AngularFilling a button background from left to right using CSSCSS