LPGhatguy / node-sass-glob-once

Allows single-import globs with Node Sass
MIT License
0 stars 0 forks source link

@import from different subfolders isn't removed #1

Open kyvour opened 8 years ago

kyvour commented 8 years ago

Hi First of all, thank you for your importer. It's a really cool and useful thing!

I'll try to describe my issue with example I have the next file structure -style.scss --base -_root.scss --components -_test.scss -_test2.scss

base and components are folders with scss styles. I have the same import in each scss file, for example @import 'toolkit/kickstart'

The result styles has the parts with same code. In this example import from style.scss, _root.scss, _test.scss aren't removed and compiled in css. But import from _test2.scss was removed. As I understand it's because another file (_test.scss) from the same folder (components) already has same import. In this case your importer works fine.

So as I understand your importer does not react to the imports in the nested folders.

LPGhatguy commented 8 years ago

Hi! Thanks for the report.

In truth I've been putting most of my focus into my PostCSS import plugin that tries to solve the same problem from a different angle. It's what my team has been using and might be a better solution in the long-run.

That being said, I'll still look into this issue when I find time -- it looks like it might be dependent on the ability to turn off single import on a per-import basis, which is something that postcss-sassy-import does but this plugin does not at this time.

kyvour commented 8 years ago

Thanks for your answer. I think this bug isn't critical (as for me). I always tries to import partial files which have styles in one place. As for postcss-sass-import - can it replace this module? All what I need - to import scss files with glob patterns without duplicates. I already have postcss in my project so I can replace one module with another. But probably some people don't want to use PostCSS for some reason. In this case current module will be very useful.

LPGhatguy commented 8 years ago

Yes, postcss-sassy-import can generally replace this module in functionality.

I think it might actually target more people because it isn't limited to just Sass, it works with LESS and even pure CSS as far as I know, but bringing in PostCSS might be a big deal.

I mostly went that direction because the custom import system in node-sass is kind of limiting (only a single importer can run for a given importer, there are edge cases, and the context of imports isn't always clear) -- PostCSS is a little nicer on the API front there.

If you give it a go and have any issues trying to integrate the other plugin, you can file an issue there and I'll do my best to help you out. Otherwise, I'll set aside some time to take a closer look here. Thanks!