0

I was learning about Laravel Mix that allows us to compile Javascript and CSS files in our project. As I see, in resources/js folder, we can put all the javascript files that should be compiled and in resources/sass folder - all the css files. Using webpacker.mix.js, we import everything in app.js and app.scss but what I want to know is the following: Since, sass files are compiled into CSS, is it possible to import CSS files (and not SASS files) in app.scss? For example, to have this in app.scss:

@import ('css/style.css')

and not

@import ('css/style.scss')

?

2

1 Answer 1

0

Import is not a sass, but a plain css rule. You can use it to import normal css files, yes.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you! and also, if I have @import ('css') (css is a folder in resources where there are all my css files), will this be right syntax? Because, when importing _variables.scss file, it starts with underscore. (Actually, I don't know that this underscore does)
I don't think you can import directories with one statement, but you need to import each file. The underscore in scss or sass indicates that it is not a standalone file, but a file that is going to be imported elsewhere. It helps others to understand your score, and also SASS won't compile files beginning with a _. See kolosek.com/sass-import for details
@code_locked the underscore tells the compiler that the file is an "include".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.