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 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #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

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
Attributes and Properties in JavaScript and HTMLHTMLContainers 101: What are containers?MiscellaneousHow to change the Login Logo in WordPress?WordPressWhat is a component helper function in React?ReactWhat happens when we add Numbers and Strings in JavaScript?JavaScriptCROSS JOIN in PostgresPostgresCan Firewall and IDPS Stop DDoS Attack?MiscellaneousSolution to “TypeError: ‘x’ is not iterable” in Angular 9AngularSolution for “Yarn build: Failed because of a stylelint error”WordPressHow to select multiple values in React dropdown?ReactModules and its Core features in JavaScriptJavaScript@mixin and @include in SCSS (Sass)SCSS