Closed toomuchdesign closed 7 years ago
Eagerly awaiting a resolution to #6. This was functionality postcss-import
7.x had before it removed globbing, so I'm relying on it.
same here, please merge :)
@TrySound #ping? 🚢 :shipit: /cc @toomuchdesign @timkelty @gunzip
@TrySound kindly made me a collaborator so we can get some outstanding issues resolved. I'll take a look at this PR later on as it seems like a great addition :)
Nice @simonsmith. Hope the 👊 bump helped. ;-) Love this project and glad to see you aboard! Gotta keep momentum going. 🙏 What left do we have to do to merge this in?
I'm currently just working on upgrading some of the dependencies. Moving to latest AVA broke all the tests bizarrely. Once that is sorted I can address the changes here
Hi @simonsmith, you probably know, but AVA 0.17.0 changes process.cwd()
behaviour. Already hit that once!
https://github.com/avajs/ava/releases/tag/v0.17.0
@toomuchdesign Oh nice, that might be my exact issue as all the tests were failing to resolve modules. I haven't used AVA before so wasn't up to date on changes. Thanks for the tip!
I was also wondering about whether this feature should be a default rather than behind an option. We could remove glob
as an option and just let the plugin decide what to do based on isGlob
.
So something like this in index.js
:
opts.resolve = function(id, base, opts) {
if (isGlob(id)) {
return resolveGlob(id, base, opts);
}
return resolveModule(id, base, opts);
};
I can't see a reason why someone would pick glob or resolve if it could be done dynamically.
Probably someone might want to be able to preventively select just glob
or module
resolve in order to be sure that nothing is imported by chance. But it's just speculation! Thanks for handling the maintainance , @simonsmith.
Cheers!
True, although if you're using globs you would probably know what to expect. For example not caring about order of imports.
My thoughts were that this should work out of the box:
@import "suitcss-base";
@import "./components/*.css";
Are you happy to rebase this with master and/or make changes @toomuchdesign? I can understand if not as it's months old. If not I'll pull your branch and make the updates.
Ok! I'll try to push something before next Monday.
Closing in favour of #13
Set up a dynamic resolve option to dynamically switch between globbing and module imports.
What's new I created a new
resolveDynamic
resolver which requiresis-glob
package and both the original resolvers packed with this plugin. WhenresolveDynamic
is enabled, each @import url is tested againstis-glob
regex and then processed by one of the original resolvers according tois-glob
result.resolveDynamic option Added a new
resolveDynamic
option (false
by default), which enables dynamic resolve only when set totrue
and whenglob
option isfalse
.Option name
dynamicResolve
orresolveDynamically
might be a better name for the new option ;-).