C
C
camradee2018-03-13 12:47:24
css
camradee, 2018-03-13 12:47:24

How to organize import to sass file when using mobile first?

There is a main style file called style.scss with the following structure:
/* For mobile: */
/* For smartphones: */
@ media only screen and (min-width: 480px) {
}
/* For desktop and tablets sm: */
@ media only screen and (min-width: 768px) {
}
/* For desktop md */
@ media only screen and (min-width: 992px) {
}
/* For desktop lg */
@ media only screen and (min- width: 1200px){
}
At the same time, some styles are placed in separate files. If there were no media breakpoints, then we do @ import "..." at the beginning of the main style file, but what if the styles being imported also have @ media, how in this case should we properly import and organize the files? Of course, you can leave only the mobile version in the imported files and override what is required in @ media in the main file. But somehow that doesn't seem like a good option.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question