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')

?

code_locked
  • 95
  • 4
  • 12

1 Answers1

0

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

Matthias S
  • 3,358
  • 3
  • 21
  • 31
  • 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) – code_locked Sep 11 '18 at 13:43
  • 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 https://kolosek.com/sass-import/ for details – Matthias S Sep 12 '18 at 10:46
  • @code_locked the underscore tells the compiler that the file is an "include". – Daniel Sogbey Feb 05 '22 at 09:56