Some Background
As the
document
instructs, we can do
// Gantry 5 custom CSS file
// import breakpoints
@import "dependencies";
// Typical values are the default breakpoints set in Gantry 5
// but these values are user definable in style settings
// so that is why the code below uses mixins to get the actual
// values from Gantry 5 template.
// commonly used media queries
// typically min 75rem
@include breakpoint(large-desktop-range) {
}
// typically range 60rem to 74.938rem
@include breakpoint(desktop-range) {
}
...
in the custom.scss file. So I did before, and I put all custom styles in this custom.scss file. But later I find that some custom styles are useless to some page (for example, the custom styles of homepage slideshow are useless to an article page), so I decided to load different css file for different page (like homepage.css is for hompeage, and article.css is for article page), and only keep those global custom styles (like that of Navbar) in custom.scss file. Thanks to gantry 5, this has been much easier, I even modify the build-in "cutsom css/js" atom so that it can accept scss files.
Problem
The problem is, to use media queries in my own scss file (like homepage.scss), I need to insert the above code to too. Thus, in my homepage, the content of _breakpoint.scss is loaded twice (firstly in custom.scss, and secondly in homepage.scss). This also happens when I try to load some other scss libraries. For example, if I have a _color.scss which defines
To be able to use this $blue variable in both custom.scss and homepage.scss, I'd have to do
in both files, I feel this is redundant. Is there anyway to overcome this problem?