TrySound / postcss-easy-import

PostCSS plugin to inline @import rules content with extra features
MIT License
201 stars 25 forks source link

Allow both module lookup and glob imports at same time #6

Closed toomuchdesign closed 7 years ago

toomuchdesign commented 8 years ago

Hi @TrySound , thanks for your great plugin! I have a question about the opportunity of a new feature. Do you think would it be possibile to extend @import resolution and make it accept both module lookup and glob imports at same time?

In my case I have a project where I'd like to import some CSS with a standard modules @import tree and some others CSS picking the files up with a **/*.css globbing style into a specific folder.

Any advice would be greatly appreciated.

Andrea

toomuchdesign commented 8 years ago

Hi @TrySound, back to this feature: I'm thinking to use a helper like is-glob to switch between glob and module resolves. Under the hoods is-glob tests a regex against a string. This additional operation might have a little cost in terms of performances, but we might keep this feature optional and avoid breaking changes.

Please tell me you'd like me to work on a pull request. Cheers!

mehcode commented 8 years ago

@toomuchdesign Definitely would appreciate this feature. :+1:

toomuchdesign commented 8 years ago

The feature is almost ready! @TrySound. I noticed that resolve modules tests are disabled by a test.only assertion. Is it intentional, or I can let the runner trigger the whole set of tests? On my machine tests are all ok.

toomuchdesign commented 8 years ago

Pull request done. I'm available for any further consideration. Greetings!

LostSenSS commented 8 years ago

👍

toomuchdesign commented 8 years ago

Please notice that, aside this feature, postcss-easy-import v1 wraps postcss-import v.8 which is currently unreliable due to this bug. So, beside this pull request, there is still to decide if switching back to postcss-import v.7 or waiting for a patch.

pushred commented 8 years ago

I'm curious why the behavior was made mutually exclusive in the first place.. hiding it behind this option is pretty confusing. Is it really that slow to test each import?

toomuchdesign commented 8 years ago

I added the feauture as an option to not introduce a breaking change. If you consider a big project with hundreds of imports to be re-evaluated on each ctrl+s, even a small delay might be worth of consideration! Furthermore this feature is almost useless in a webpack-like based project.

simonsmith commented 7 years ago

The long standing import bugs in 8.x of postcss-import have been fixed.

simonsmith commented 7 years ago

Fixed in https://github.com/TrySound/postcss-easy-import/pull/14