It seems that the problem is not duplication of styles, but duplication of libraries or configuration files. To do this, all that is required is to simply structure your code in a slightly different way. Start by partially modifying your global.scss file by changing its name (like everyone else) to start with an underscore, _global.scss . Then create a manifest file, for example app.scss . Inside, import _global.scss and any other files you need. These other files will now have access to everything app.scss has access app.scss :
_global.scss
$white:
_header.scss
.foo { width: 100px; height: 50px; background-color: $bg_red; }
_main.scss
.mt30 { margin-top: 30px; } .boo { width: 100px; height: 50px; background-color: $white; }
app.scss
// Import libraries and config; adding compass as an example @import "global"; @import "compass/css3"; // Actual selectors @import "header"; @import "main";
Since you are importing global in front of the header and main, the last two will have access to what was in the first. It should also be noted that I moved one .mt30 declared style from global to primary partial, just to make sure that no style was declared in the global configuration file.
dinocarl
source share