Closed mvenghaus closed 5 years ago
Hey @mvenghaus I'm not quite sure if I understand your problem correctly? If the same files are imported multiple times, they end up multiple times in the final CSS. That's the intended behavior.
I've the following file structure. The "_module.scss" should always include all sub scss files.
main.scss
module1/_module.scss
module1/source/_sub1.scss
module1/source/_sub2.scss
module2/_module.scss
module2/source/_sub3.scss
module2/source/_sub4.scss
main.scss
@import "*/_module.scss";
Content of every "_module.scss"
@import "source/**/*.scss";
Problem is that _sub3 und _sub4 are never used .. instead I've the content of _sub1 and _sub2 twice.
Have you already tried @import "**/_module.scss";
?
Oh.. I misunderstood the exact problem. I'll try to reproduce on my own machine and reach back to you! Thanks for reporting this issue.
Hey @mvenghaus!
I've investigated further and I'm pretty sure this is not a problem with this package but rather with node-sass
itself. This issue seems to describe the same problem: https://github.com/sass/node-sass/issues/2556
See also my test case for this issue: https://github.com/maoberlehner/node-sass-magic-importer/pull/new/bugfix/same-dir-name-glob
Importer entries in libsass are built using (name, contents, src map) triple. You might have a look at the sample C code and the API definition (look for for sass_make_import_entry
).
The name (file
parameter in node-sass) is still used and assigned even if no files are involved. If you play with importers a lot and you generate code on the fly I'd make sure to use the file
parameter and give it unique name. Maybe we should document it better.
I know it's messy - that is why this is an experimental feature.
https://github.com/sass/node-sass/issues/2556 has been solved - it is possible to teach importer how to deal with files that bear the same file name but are spread across the directory structure.
Hello,
when i import two files and these two files import files using the same pattern I get the same content twice.
Example: main.scss
folder1/_file.scss
folder2/_file.scss
It seems that the pattern is the key of an array and cannot be used twice.
Any suggestions?
Thx Marcus