Sometimes during layout, it is necessary to split style files into several ones according to some principle. In this article, we will split the styles into the main file and the file for IE9.
Folder structure (are displayed only those folders that we need for this article):
Since sass does not compile files starting with the “_” character, only the main files are in the final css. Now it works as follows:
main_global.scss - styles of the whole project without IE9
ie_9.scss - styles of the whole project + IE9
Let’s see how it works.
In the _mixins.scss file, declare a mixin to separate the styles of IE9:
Include all individual styles in one file:
_includes.scss
The main style file looks like this:
We are not interested in the whole file at the moment, pay attention to two key points:
All styles except IE9 will be included in our file.
The file for IE9 will differ only in the $ie9 variable.
ie_9.scss
Now write down the styles in _main.scss we and see the result: