How can I Include .scss
file in another .scss
file? I was trying to write this in a file: app.scss:
@include('buttons'); @include('dropzone'); body { background: $primaryColor; overflow-x: hidden; /*Clip the left/right edges of the content inside the <div> element - if it overflows the element's content area: */ height: 100%; /* Cover all (100%) of the container for the body with its content */ padding-top: 70px; } /* more css code here */
and it returns an error : invalid css after @import
I try to include 2 other scss files inside the main scss
file, so it will be all compiled to one css
file eventually. How is it possible?
You can use @use rule for it. This rule loads another Sass file as a module, which means you can refer to its variables, mixins, and functions in your Sass file with a namespace based on the filename. Using a file will also include the CSS it generates in your compiled output!
The Sass @import directive extends the CSS @import rule so that it works with . scss and . sass files. It imports the file referenced and any variables or mixins that are defined in the imported file so they can be used in the main file.
It is now possible to import css files directly into your sass file. The following PR in github solves the issue. The syntax is the same as now - @import "your/path/to/the/file" , without an extension after the file name. This will import your file directly.
You can import it like this;
@import "../../_variables"; @import "../_mixins"; @import "_main"; @import "_login"; @import "_exception"; @import "_utils"; @import "_dashboard"; @import "_landing";
According to your directories and it will do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With