Is it possible to check if a file exists with sass (.scss) I want to import a file if it exists and if not import another file. Is that possible?
I'm not using compass (suggested duplicate question)
The SASS @import function helps us to import multiple SASS or CSS stylesheets together such that they can be used together. Importing a SASS file using the @import rule allows access to mixins, variables, and functions to the other file in which the other file is imported.
The @use rule loads mixins, functions, and variables from other Sass stylesheets, and combines CSS from multiple stylesheets together. Stylesheets loaded by @use are called "modules". Sass also provides built-in modules full of useful functions.
You can not "import" a SASS/SCSS file to an HTML document. SASS/SCSS is a CSS preprocessor that runs on the server and compiles to CSS code that your browser understands.
Unfortunately there is no way to do this. If you import a file which doesn't exist, you will get an error immediately (even if it is placed under a false condition)
it is discussed here
also functionality of import described here comprehensively
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